Figure 9.22 Eclipse presents test results from JUnit tests that were run inside a framework in the same
GUI format as normal JUnit results.
launch only your test bundle and any required bundles. If you're not using Tycho, you
can easily launch an OSG i framework that's identical to your Eclipse target platform,
but you may not have much command-line support for running the tests.
Testing with bndtools
If you're using bndtools instead of Eclipse PDE , you still have options for running your
unit tests inside Eclipse. To run a JU nit test from inside Eclipse, right-click on the test
and choose Run As > OSG i JU nit Test (see figure 9.23).
Just as Eclipse can use the target platform to provision and launch an OSG i frame-
work, bndtools can provision a framework from its repository.
By default, Eclipse launches with the whole target platform, although subsets of
the target platform can be specified in the run configuration. Bndtools, on the other
hand, requires you to explicitly list each bundle from the repository that should be
included in the run configuration. Bundles that your project explicitly depends on
will be automatically included. (This may sound a lot like Tycho right about now!)
Even Pax Exam includes some Eclipse support for testing. The 2.2 release of Pax
Exam includes an Eclipse plug-in that flags common configuration problems as com-
pile errors. Pax Runner also provides an Eclipse plug-in that provides launch configu-
rations for all the OSG i frameworks Pax Runner supports.
Bndtools can run JUnit tests inside an OSGi framework from within Eclipse.
Search WWH ::