This recipe will guide you through the basic setup of a Pax Exam test environment using the Felix framework as the core OSGi container. The next recipe will cover how to combine Pax Exam and Apache Karaf.
As usual, the sources can be found at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter10/chapter10-recipe1.
To perform integration tests with Pax Exam, the POM configuration is essential, since it is already part of the build environment. For example, use the pax-exam-container-native
artifact and of course it is mandatory to connect JUnit with Pax Exam. This can be done as follows:
… <properties> <version.pax-exam>3.4.0</version.pax-exam> <junit.version>4.11</junit.version> </properties> … <dependency> <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-junit4</artifactId> <version>${version.pax-exam}</version>...