In my team we were trying to move our tests to JUnit5 but we have multiple problems with the tests requiring OSGi runtime. We have a fragment defined with the tests run by tycho-surefire-plugin. We also had couple of org.junit.rules.TestRule defined which we were trying to move to JUnit5 extension model. We've done it and it all runs as expected when run from eclipse as Plugin Tests against 2019-12 platform. However when running our maven build we've run into several problems:
- AbstractMethodError when calling ParameterContext#isAnnotated()
- Extensions not working when declared through @RegisterExtension annotation
- @TempDir annotation not working (no field is injected)
- The extension which uses ExtensionContext.Store to inject ClosableResource does not work as expected because ClosableResource#close() method is not called once the context is killed
Overall looking at the versions where certain mechanisms were introduced (e.g. ClosableResource in 5.1) it seams that when running tests through tycho-surefire-plugin JUnit5 is in some mixed versions state where some classes are taken from 2019-12 platform in versions 5.5.1/1.5.1 while others provided with org.eclipse.tycho.surefire.junit5 bundle are in versions 5.0.3/1.0.3. I've already commented here https://bugs.eclipse.org/bugs/show_bug.cgi?id=537487
about this. Is it possible to make it right and run those tests against classes from target platform only or am I tied to 5.0 versions APIs and need to wait for update of classes in surefire bundle?