Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSGI Integration Testing and Code Coverage

We have Desktop app deployed in OSGI bundles and have integration tests to test bundles loaded in OSGI container.

  1. I am seeking a tool that calculates code coverage for integration tests with OSGI bundles
  2. Currently we are trying to do with Jacoco and Sonar that is good for integration tests code coverage, but we aren't sure whether they are good enough to handle OSGI integration test code coverage
  3. also any other tools available to calculate OSGI integration test code coverage.
like image 540
Leo Prince Avatar asked Jan 05 '12 04:01

Leo Prince


1 Answers

Most, if not all code coverage tools should work with OSGi. Their general strategy is to post process the bytecode to inject extra code that allows them to measure such coverage. The biggest issue that causes is that this code now usually has dependencies on extra code (the code coverage library). Such dependencies can either be made explicit (by adding Import-Package statements) just like with any other dependency.

The other option you have is to add the code coverage library to your bootclasspath so you don't need those extra imports (which breaks modularity, normally not something you want, but in this case irrelevant). Once you solve this problem, the rest is a matter of instrumenting the right bundles and aggregating the results of multiple different test runs.

like image 106
Marcel Offermans Avatar answered Oct 20 '22 22:10

Marcel Offermans