jacoco and OSGi coverage

Dako Dakov
2012-07-03
2013-04-24
  • Dako Dakov

    Dako Dakov - 2012-07-03

    Hello,

    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?

    Thanks,
    Dako

     
  • Marc R. Hoffmann

    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?

    Best regards,
    -marc

     
  • Dako Dakov

    Dako Dakov - 2012-07-04

    Hi Marc,

    yes the classes are visible under the "Sessions" page.

    Best regards,
    Dako

     
  • Dako Dakov

    Dako Dakov - 2012-07-04

    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.

    Best regards,
    Dako

     
  • Marc R. Hoffmann

    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.

    Cheers,
    -marc

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks