tags:

views:

1715

answers:

5
+3  Q: 

OSGi Testing

Hi all.

Currently, I am working on a new version control system as part of a final year project at University. The idea is to make it highly adaptable and pluggable.

We're using the OSGi framework (Equinox implementation) to manage our plug ins. My problem is that I can't find a simple & easy to use method for testing OSGi bundles.

Currently, I have to build the bundle using Maven and then execute a test harness. I'm looking for something like the JUnit test runner for Eclipse, as it will save me a bunch of time.

Is there a quick and easy way to test OSGi bundles?

EDIT: I don't need something to test Eclipse plug ins or GUI components, just OSGi bundles.

EDIT2: Is there some framework that supports JUnit4?

+2  A: 

Spring Dynamic Modules has excellent support for testing OSGi bundles.

flicken
Using SpringDM, I just get this: junit.framework.AssertionFailedError: Exception in constructor: testOSGiStart (java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryAny ideas? I've added commons-logging to the build path, btw.
fluffels
Also, SpringDM doesn't seem to support JUnit4, is this correct?
fluffels
+1  A: 

Eclipse has a launch configuration type for running JUnit tests in the context of an Eclipse (i.e. OSGi) application:

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.pde.doc.user/guide/tools/launchers/junit_launcher.htm

Rafael Chaves
That looks more like it tests eclipse plug ins. Was my question unclear?
fluffels
A: 

If you need to test GUI components I've found SWTBot gets the job done.

Thanks, but I don't need to test GUI components, or Eclipse plugins.
fluffels
+3  A: 

There is a dedicated open source OSGi testing framework on OPS4J (ops4j.org) called Pax Drone.

You might want to have a look at Pax Drone ([http://wiki.ops4j.org/confluence/x/KABo]) which enables you to use all Felix Versions as well as Equinox and Knopflerfish in your tests.

Cheers, Toni

Toni Menzel
Mmmm... Maven can't seem to locate Pax Drone, and I can't find any alternative repositories mentioned in your link. Any help?
fluffels
Thanks for the pointer. I just updated the site for that.FYI: you can find it here: http://repository.ops4j.org/maven2
Toni Menzel
A: 

Treaty is a contract(testing) framework that is pretty academic but has some nice ideas. There are papers that are published on it, and the people currently working on improving it.