Menu

MeasuringCodeCoverage

Since OSGi modifies the class loading, most of the tools available don't work in an OSGi environment.

Marc R. Hoffmann describes a basic approach for solving this problem on the eclemma research site.

All jar files needed to run the eclemma/emma code coverage tool with OSGiUnit tests are now part of the osgiunit.externals project.

There is a second build file (build_cc.xml (osgiunit.svn.sourceforge.net)) in the osgiunit.examples project which shows how to run the eclemma and emma tools to create a coverage report.

Simply run

ant -f build_cc.xml clean JUnit emma-report

and find the HTML report in the file coverage/coverage.html (osgiunit.sourceforge.net).

One problem currently exists: The coverage report shows only the functions and the number of blocks covered, but does not show the sourcecode lines.

Coverage report from the osgiunit.example project (osgiunit.sourceforge.net)

EMMA Homepage

EMMA Eclipse Plugin

Using EMMA in OSGi applications


MongoDB Logo MongoDB