On 8 Oct 2010, at 23:36 , Bram de Kruijff wrote: >> I would definitely go with Pax Exam for integration tests and JUnit for unit >> tests. > > Never used it, but looks good so let's give it a try! I am curious to see a > comprehensive example in action ;)
In fact many Felix subprojects use it so it should not be too hard to find an example. The anatomy of a Pax Exam test is very similar to a normal unit test with a few exceptions: 1) there is a static initializer block in each test class that defines a list of bundles that should be deployed to run the test (and there are some other things you can specify there too, but at least a list of bundles). 2) the test has an extra annotation that indicates it should be run with Pax Exam instead of normal JUnit. 3) the test methods take a BundleContext so you can access the framework (and I commonly create a new DependencyManager(bundleContext) as one of the first lines of my test so I can declare my other dependencies in the test). A nice feature of Pax Exam is that you can easily run single tests from within Eclipse (just Run As JUnit and it works). >> Next step would be to add support for measuring code coverage. > > Was just looking into the build and added cobertura (not committed). Will > that work with Pax Exam? Cause we def need coverage. That should work, we don't use it in Felix but it's quite easy to use Cobertura on "anything". We need to take a good look at what we instrument and what not. Also, how to aggregate all coverage results. We have some experience in Apache ACE (back in the days when it was built with Ant) on how to do this. Greetings, Marcel

