junit4osgi framework architecture¶
This page describes the architecture of the junit4osgi framework. This does not include the maven-junit4osgi-plugin.
!junit4osgi-arch.png|align=center, width=50%, height=50%!
A system tested with junit4OSGi is divide in three parts:
1. The tested system composed by bundles/services/... composing the system under tests. This can be the
1. Tests bundles containing tests stressing/checking the system under tests.
1. The junit4OSGi framework composed by a runtime bundle (executing tests) and a runner bundle (launching test).
junit4OSGi does not impacts anything on the system under test. Test bundles interact with the system under test via services/events ... Bundle containing tests declared contained test suites in there
manifest such as:
Test-Suite: org.apache.felix.ipojo.test.scenarios.ps.ProvidedServiceTestSuite, org.apache.felix.ipojo.scenarios.ps.StrategyTestSuite
Thanks to this
manifest header, the junit4OSGi runtime bundle collects tests. This bundle is the core of the test framework, and manage both collection and execution of tests. The runner bundle just launch tests. According to the runner implementation, test selection can also be done. Several runner have been developped:
junit Felix command: executing test from the Felix shell (only for Felix)
Swing runner: executing test from a Swing application (works for Felix, Equinox and Knopflerfish)
Immediate runner: executing test as soon the runner arrives in the framework (works for Felix, Equinox and Knopflerfish)
Maven runner: launching an embedded Felix with required bundle and launching test automatically during the Maven build process.
Why junit 3 ?¶
The junit4OSGi framework use junit 3 because it was design and developed to test embedded systems. So, the junit4OSGi framework runs on a J2ME Foundation Profile 1.1 virtual machine (such as Mika). However, soon, junit4OSGi will evolve to support Junit4 and TestNG.