简体   繁体   中英

Junit test with osgi blueprint (apache aries or eclipse gemini)

i really can´t find a way to junit test blueprint. With Spring DM (this dead project) was very simple to test the same spring beans with junit and some mocks. In blueprint (either aries or gemini) is nothing like SpringJUnit4ClassRunner.

Pax Exam is to complicated for unit testing and don´t produce some structural test results.

Do you have some idea, how to junit test blueprint?

I wrote a testrunner bundle that runs every service as a JUnit test if the osgitest=junit4 service property is there. It uses the interface of the service to search for annotations.

I also wrote eosgi-maven-plugin that can start an OSGi environment during the integration-test phase of maven and run the tests with the help of the testrunner bundle.

With these tools my aim was to be really technology independent. The only requirements are that the application must run on an OSGi container and the tests must be OSGi services. The bundles are the maven dependencies of the project.

There is a step-by-step guide . It is not up-to-date the name of the plugin has been changed from maven-eosgi-plugin to eosgi-maven-plugin (as maven suggested in a warning)

I hope this is the one you are looking for :)

As far as I'm concerned pax-exam is still the number one test framework for osgi. And of course blueprint. You'll find also some samples for testing with Karaf. https://ops4j1.jira.com/wiki/display/PAXEXAM3/Pax+Exam

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM