Exam Maven Plugin
Introduction
The exam-maven-plugin can be used to run integration tests on an OSGi framework launched by Pax Exam in server mode, similar to the Cargo Maven Plugin. This plugin has two goals start-test-container
and stop-test-container
which are bound to the pre-integration-test
and post-integration-test
phases, respectively.
Thus, you can run your integration tests in the integration-test
phase, and the Exam Maven Plugin will take care of starting and stopping the OSGi test container.
The Exam Maven Plugin uses the Forked Container. It requires an OSGi framework to be on the test classpath of your Maven project.
Parameters
configClass
The configClass
parameter takes the fully qualified name of a Java class with a @Configuration
method, defining the options for the Pax Exam container.
Example
<build> <plugins> <plugin> <groupId>org.ops4j.pax.exam</groupId> <artifactId>exam-maven-plugin</artifactId> <version>3.0.0</version> <configuration> <configClass>org.ops4j.pax.exam.regression.maven.ServerConfiguration</configClass> </configuration> <executions> <execution> <goals> <goal>start-container</goal> <goal>stop-container</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.12</version> <executions> <execution> <goals> <goal>integration-test</goal> </goals> </execution> </executions> <configuration> <forkMode>always</forkMode> <parallel>none</parallel> <threadCount>1</threadCount> </configuration> </plugin> </plugins> </build>
There is an example project in the Pax Exam regression test suite.
Compatibility Note
The current exam-maven-plugin
is completely unrelated to and not to be confused with the maven-paxexam-plugin
of Pax Exam 1.x. The latter is obsolete, no longer maintained and only works with Pax Exam 1.x and Pax Runner.