Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After importing the jacoco session into eclipse it shows zero coverage

Tags:

jacoco

I was following the following steps to measure the code coverage using jacoco:

  1. I have instrumented my application wars files on the fly using jacoco agent.
  2. Started the tomcat server.
  3. Run some test cases.
  4. Stopped tomcat server.
  5. After stopping the tomcat server .exec coverage file gets generated in the destination folder.
  6. In eclipse I opened my project work space.
  7. I had imported the .exec file, but it shows 0% coverage for my maven multi-module project.

Please provide the steps how can I fetch exact coverage report from this .exec file.

like image 826
Tauseef Husain Avatar asked Mar 14 '26 19:03

Tauseef Husain


1 Answers

Could it be that the classes deployed into Tom Cat were compiled differently, at a different time or with a different JDK from those in Eclipse?

The EclEmma import docs at http://www.eclemma.org/userdoc/importexport.html say

Warning: Imported execution data must be based on the exact same class files that are also used within the Eclipse IDE. If the external launch was based on different class files (e.g. created with different compiler) no coverage will be shown.

The execution data stores a hash of the class it was generated for, so if it doesn't match the hash corresponding class in Eclipse you'll see no coverage.

like image 77
Spangen Avatar answered Mar 17 '26 20:03

Spangen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!