In a bundle that holds integration tests, I would like all classes whose names end with Test to be considered as tests and be executed when launching OSGi Framework JUnit Tests.
The Test-Classes directive in the bnd.bnd file seems to be the right place to specify this. However, the documentation for the classes macro at http://bnd.bndtools.org/macros/classes.html is sparse.
Therefore, my question is how to form the directive to include all classes ending with Test along the lines of
Test-Cases: ${classes that end with Test}
My experiments so far revealed, that this directive does the trick:
Test-Cases: ${classes;CONCRETE;NAMED;*Test}
CONCRETE ensures that only concrete types are considered, e.g. excludes abstract types. And NAMED followed by the pattern *Test takes only those classes into account whose names end with Test.
Since JUnit 4 can only execute public tests, another constraint to consider might be PUBLIC. For example:
Test-Cases: ${classes;CONCRETE;PUBLIC;NAMED;*Test}
On the other hand, you may prefer to let JUnit fail non-public tests rather than silently ignoring them (if PUBLIC was specified).