Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
hiddentrue

Painless OSGi Integration Testing

Section
Column

In-Container Testing for OSGi

, Java EE and CDI

We're in the process of splitting this wiki into two separate spaces for
Info
Note

This space documents Pax Exam 2.x and Pax Exam 3.x.This space will cover Pax Exam 2.x only, once the split is complete. It will no longer be updated.

There is a separate space for the current release line Pax Exam 3.x.

OSGi Testing with Pax Exam 2.x

  • 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 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 multiple flavours: With the Pax Runner Container, the system under test runs in a separate Java virtual machine under remote control from the test driver. The Native Container launches an embedded OSGi framework in the test driver VM.
  • Test containers support different strategies for restarting or reusing the running OSGi framework for each test.
  • With Pax Exam's JUnit4TestRunner, 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) and lets you configure the combinations of framework vendors and versions for running your tests.
  • Pax Exam 2.x is the stable release line. The current release is Pax Exam 2.6.0.
  • Read more: Getting Started with OSGi Tests
OSGi, Java EE and CDI Testing with Pax Exam 3.x
  • 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 3.x is currently under development. The current milestone release is Pax Exam 3.0.0.M4.
  • Read more: Getting Started with Java EE Tests and Getting Started with CDI Tests
Column

Download 

Documentation

 Issue Tracker

Section
Column

Latest News

Blog Posts
3
spaces@all
labels+pax-exam
3