TestNG for OSGi Bundles

Problem: We need to test bundles deployed in OSGi.

Solution: Bundle test classes as xyz_tests.jar file. Convert this into bundle and deploy along with main bundle code.
In test bundle activator, programmatic way call TestNG as shown in http://testng.org/doc/documentation-main.html

TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { Run2.class });
testng.addListener(tla);
testng.run();

TestNG opens in its own JVM. Due to this it is not recognizing test classes. We can build OSGi classpath with the help of bundle context. But we dont have option to pass classpath to TestNG programitically. Even though we can pass, it uses jar files in path, But not the bundles.

Conclusion: We can’t use TestNG inside OSGi. Please let me know your experience.

-o-

Advertisements

One thought on “TestNG for OSGi Bundles

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s