On Thursday, December 27, 2018 at 7:17:38 PM UTC+1, Balesh koijam wrote: > > here is an example where i am able to replicate the same issue mentioned. > > https://github.com/baleshkoijam/Example-sb-cucumber-jacoco-project >
$ git clone https://github.com/baleshkoijam/Example-sb-cucumber-jacoco-project $ bash ./gradlew build > Task :bdd:compileTestJava FAILED /private/tmp/j/Example-sb-cucumber-jacoco-project/bdd/src/test/java/stepdef/stepdef.java:8: error: package hello does not exist import hello.Data; ^ 1 error FAILURE: Build failed with an exception. > i had included the jacoco.exec file which was generated, you can use this > file to see the code coverage report if required, > exec files are not portable, because they depend on class files and different versions of compilers produce different class files - https://www.jacoco.org/jacoco/trunk/doc/classids.html In other words: exec file produced on one machine for one version of class files, will be unusable on the other machine where class files are different. However according to inspection of exec file content by JaCoCo Command Line Interface ( https://www.jacoco.org/jacoco/trunk/doc/cli.html ): $ java -jar .jacoco-0.8.2/lib/jacococli.jar execinfo jacoco.exec | grep "hello" | wc -l 0 Your exec file doesn't not contain any information about classes in package "hello". Page https://www.jacoco.org/jacoco/trunk/doc/agent.html states At VM termination execution data is written to the file specified in the destfile attribute. Execution data is written during execution of JVM Shutdown hook ( see http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread) ) Whose execution not guaranteed if JVM was not gracefully terminated. Your https://github.com/baleshkoijam/Example-sb-cucumber-jacoco-project/blob/044028e9bfed915eb45757bf829c48a4b4add81c/README.md states Stop the boot run. Which I assume is a hard kill by IDE and not at all a graceful termination. To quickly confirm this - use different exec files for different JVMs and you'll observe that one used for "boot run" will be empty. Moreover agent used for JVM that executes your CucumberRunner will never record execution of classes in package "hello", because they are executed by another JVM. -- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/52c580d4-aa6c-4060-971b-723fe4551273%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
