Pax Exam

This Confluence space covers the Pax Exam 3.x release line. The current Pax Exam 4.x release line is documented in the OPS4J Pax Exam 4.x space.

 

In-Container Testing for OSGi, Java EE and CDI

OSGi Testing

  • Pax Exam lets you take control of the OSGi framework, the test framework (e.g. JUnit) and your system under test at the same time.
  • Pax Exam is also able to bootstrap a Apache Karaf container allowing you to directly execute commands, deploy features, etc.
  • Pax Exam has a test driver and a test container. The driver launches the OSGi framework and the system under test. It builds on-the-fly bundles from your test cases and injects them into the container. The driver is a plain old Java application and does not itself require an OSGi framework.
  • The test container comes in two flavours: The Native Container launches an embedded OSGi framework in the test driver VM. With the Forked Container, the system under test runs in a separate Java virtual machine under remote control from the test driver.
  • Test containers support different strategies for restarting or reusing the running OSGi framework for each test.
  • With the PaxExam JUnit runner, you simply need to add some special annotations and a configuration method to a JUnit class to run your OSGi tests. Thanks to this runner, any JUnit integration (e.g. in Eclipse or Maven Surefire) works with Pax Exam out of the box.
  • Pax Exam itself is distributed as Maven artifacts and lets you provision Maven bundles to your OSGi framework directly from local or remote Maven repositories.
  • Pax Exam supports all major OSGi frameworks (Equinox, Felix, Knopflerfish).
  • Read more: Getting Started with OSGi Tests

Java EE and CDI Testing

  • Pax Exam 3.x generalizes the in-container testing approach to cover not only OSGi, but also Java EE and CDI components and applications.
  • Simply add @RunWith(PaxExam.class) to your JUnit test classes and let Pax Exam launch a full-blown Java EE server or a stand-alone CDI container and execute your tests within the container.
  • In Java EE mode, Pax Exam uses sensible defaults to build a test WAR on the fly, based on the classpath. There is no need to explicitly configure this WAR for each test.
  • All classes of a test suite can share the same setup.
  • Pax Exam supports GlassFish 3.x and 4.x, JBoss AS 7.1 and 7.2, Wildfly 8.0, Resin 4.x and TomEE 1.5.1.
  • In CDI Java SE mode, Pax Exam supports both OpenWebBeans and Weld.
  • Read more: Getting Started with Java EE Tests and Getting Started with CDI Tests

Unit Test Frameworks

Pax Exam is best used with JUnit 4, but also supports TestNG 6.

Latest News

Pax Exam 3.5.0 Released

The Pax Exam team is happy to announce the release of OPS4J Pax Exam 3.5.0.

Highlights:

  • A new servlet probe invoker based on JAX-RS 2.0.
  • CDI mode now supports PerClass strategy and JAR probes.
  • OSGi mode: Bundles can now be referenced by symbolic name with the new linkBundle() option, requiring bundle links generated by the new goal generate-link-files of the exam-maven-plugin.
  • The WildFly test container supports WildFly 8.0.0.Final (also tested with 8.1.0.CR1).
  • The Karaf test container supports Karaf 3.0.0.

In addition, there are various bugfixes and dependency upgrades.

Known issues:

  • The TomEE test container is compiled against TomEE 1.6.0.1 but requires 1.6.1-SNAPSHOT at runtime due to TOMEE-1119.

All Pax Exam users are recommended to upgrade to Pax Exam 3.5.0.

As usual, Pax Exam artifacts are available from Maven Central.

Changes since 3.4.0

type key summary
Loading...
Refresh

Pax Exam 3.5.0 Released

The Pax Exam team is happy to announce the release of OPS4J Pax Exam 3.5.0.

Highlights:

  • A new servlet probe invoker based on JAX-RS 2.0.
  • CDI mode now supports PerClass strategy and JAR probes.
  • OSGi mode: Bundles can now be referenced by symbolic name with the new linkBundle() option, requiring bundle links generated by the new goal generate-link-files of the exam-maven-plugin.
  • The WildFly test container supports WildFly 8.0.0.Final (also tested with 8.1.0.CR1).
  • The Karaf test container supports Karaf 3.0.0.

In addition, there are various bugfixes and dependency upgrades.

Known issues:

  • The TomEE test container is compiled against TomEE 1.6.0.1 but requires 1.6.1-SNAPSHOT at runtime due to TOMEE-1119.

All Pax Exam users are recommended to upgrade to Pax Exam 3.5.0.

As usual, Pax Exam artifacts are available from Maven Central.

Changes since 3.4.0

type key summary
Loading...
Refresh

The Pax Exam team is happy to announce the release of OPS4J Pax Exam 3.4.0.

This release includes a number of improvements for Apache Karaf test container, especially the support of the KARAF_ETC variable and the support of the JMX RBAC security.

All Pax Exam users are recommended to upgrade to Pax Exam 3.4.0.

As usual, Pax Exam artifacts are available from Maven Central.

Changes since 3.3.0

type key summary
Loading...
Refresh