Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Arquillian compare to Pax Exam for OSGi (integration) testing?

I am currently investigating how best to test our OSGi application intended to run on Apache Karaf. The obvious option is Pax Exam with labs-paxexam-karaf (see http://iocanel.blogspot.com/2012/01/advanced-integration-testing-with-pax.html for a tutorial). However, I am concerned about performance (since Pax Exam apparently starts a new framework for every test method). I've also found that Arquillian has some OSGi support, though that isn't its main focus. JUnit4osgi isn't an option, as it only supports JUnit 3.

For someone unfamiliar with either framework, which is better to start with? What are the tradeoffs?

like image 226
Alexey Romanov Avatar asked Feb 21 '23 18:02

Alexey Romanov


2 Answers

Why use Arquillian if you're after proper OSGi support? =)

When looking at PaxExam make sure the docs refer to PaxExam 2 - there are substantial differences between v 1 and 2.

PaxExam will take a while to get to grips with, but you'll learn heaps about OSGi in the process (definitely a good thing, but can still hurt).

In parallel to @Dmytro's answer, the Test Containers include a Native container which is run with the same VM as the junit test - meaning you can launch with debug in Eclipse. This works especially well with the org.eclipse.m2e:lifecycle-mapping maven eclipse plugin and the org.ops4j.pax.exam:maven-paxexam-plugin. This method is fantastic, complete IDE integration.

PaxExam documentation is a bit sparse, but there are some good examples (see the Native launcher with main method that provides interactive shell) and wiki doc. If you get stuck the mailing list people ([email protected]) are very helpful.

Another alternative is to look at Karaf's paxexam, very slick and easy to get a Karaf instance up and running (features.xml etc).

Personally, I just use PaxExam2 as I'd prefer to have no explicit dependencies on the framework provider (nothing against Karaf at all, it rocks).

like image 140
earcam Avatar answered Apr 06 '23 13:04

earcam


Based on Reactor Strategies Pax-Exam can run all test methods in the same OSGi container.

like image 45
Dmytro Pishchukhin Avatar answered Apr 06 '23 14:04

Dmytro Pishchukhin