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-




Hi, have you ever used the junit4osgi ? I´m learning about it now, and looks very interesting. It has a felix-command so u can call tests suite inside your bundles.
If you wanna try this: http://felix.apache.org/site/apache-felix-ipojo-junit4osgi-tutorial.html