concept Pax Exam in category osgi

This is an excerpt from Manning's book Enterprise OSGi in Action.
The gold standard for OSGi testing tools is a tool called Pax Exam. Pax Exam is part of a suite of OSGi-related tools developed by the OPS4J open source community. In contrast to other open source communities like the Apache and Eclipse Foundations, OPS4J has an interestingly flat structure that emphasizes open participation as well as open consumption. There’s no notion of a committer, no barrier to committing source changes, and little internal hierarchy.
Pax Exam builds on other tools developed by OPS4J, such as Pax Runner, to provide a sophisticated framework for launching JUnit—or TestNG—tests inside an OSGi framework and collecting the results. Under the covers, the Pax Exam framework wraps test classes into a bundle (using bnd to generate the manifest), and then automatically exposes the tests as OSGi services. Pax Exam then invokes each test in turn and records the results.
A JUnit test intended for Pax Exam has a few key differences from one that runs standalone. Running your test code in an entirely different JVM from the one used to launch the test, with RMI and all sorts of network communication going on in the middle, isn’t something the normal JUnit test runner is designed to handle. You’ll need to run with a special Pax Exam runner instead by adding a class-level annotation:
@RunWith(org.ops4j.pax.exam.junit.JUnit4TestRunner.class)Pax Exam can also inject a bundle context into your test class: