7

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.

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this info, I was specifically looking for the above scenario!
0

We proceeded in second approach and it worked..Jacoco is able to provide Test Coverage of OSGI integration test and show in Sonar DashBoard.

1 Comment

I also tried to use, pax-exam osgi testing utility with, jacoco but was unable to generate reports, can u share your jacoco configurations?..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.