How to instrument fragment bundles JUNIT tests using Cobertura?

138 views Asked by At

We are trying to measure our code coverage of JUNIT test cases using Cobertura. Our application is a Java stack which was designed by OSGI model. Due to fragment bundle implementation of my test Cobertura is not able to calculate the code coverage against my source code. We are using surefire plugin in Maven.

Kindly share your thoughts/inputs about it.

1

There are 1 answers

0
Balazs Zsoldos On

When we started developing based on OSGi we replaced Cobertura to Jacoco as it can work as a Java agent. It also has a maven plugin.

Jacoco works until there is bytecode weaving in the runtime as in that case the hashcode of the classes will be changed. E.g.: If you use Aries-Proxy, Jacoco will not work.