I wonder if someone can point me to a good tutorial/sample/best practices about using JUnit4OSGI with Equinox as the OSGI container? I already downloaded JUnit4OSGI and started writing sample test cases, but what I'm looking for are answers for questions like:
1- How to structure the unit tests? put it in a separate bundle or each bundle should have its own unit tests?
2- How to run the unit tests using a maven plug-in? Or is there a better way?
3- How to run the unit tests during development as I understand there is a command line specific to Felix only.
Thanks.
I cannot help with Junit4OSGi but I can offer an alternative that works with Maven. It has the following parts:
Testrunner itself does not really care what technology offered the OSGi service. It could be blueprint, DS, iPojo or whatever. It needs the followings:
I think the best place to start is the maven usage site. At the moment the osgi-liquibase-bundle project uses the most up-to-date versions. Without knowing what it does, it is a good example of configuration (project hierarchy and pom.xml configuration).
All the modules and the plugin is available at maven-central.
Update
A guide about the usage of the tools is available at http://cookbook.everit.org
Update 2016.12
There is an Eclipse plugin now that allows the user to start/stop/debug/upgrade the OSGi environments specified by eosgi-maven-plugin. The usage of the plugin has benefits over the usage of richconsole.
Cookbook will be updated soon to use the Eclipse plugin instead of richconsole.