I'm trying to get use the jacoco agent to evaluate the code coverage of one OSGi bundle, but I always get 0% coverage. Here are some more details:
I've added the "-javaagent:c:/jacocoagent.jar=destfile=c:/jacocoexecctp.exec" line to the VM argument and the exec file is getting generated, but when I produce the report I always get 0% coverage.
We are using a modified version of Equinox.
Is this setup supposed to work? Did I miss something?
How do you create the report?
If you have an JaCoCo HTML report can you please open the "Sessions" page (link on the top left corner). Are the classes under test listed?
yes the classes are visible under the "Sessions" page.
I found the cause for the problem:
I use gradle for generating the bundles - before packing the jar file, gradle puts the class files under build\classes directory of your project and for the binaries source set for the jacoco report builder I specified the binaries directory of my eclipse project - I guess there's compiler difference. Once I pointed the report builder to the class files, generated with gradle, everything works fine.
Sorry for that.
Great, you resolved it! JaCoCo uses digital hashes for class identity. So the class files at runtime have to be the same than at report generation time.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.