tycho icon indicating copy to clipboard operation
tycho copied to clipboard

Replace surefire with a more native approach

Open laeubi opened this issue 4 months ago • 1 comments

We currently use an extension of Maven Surefire Plugin, but this often leads to some brittle bugs because of the classlaoding is not optimized to be used inside OSGi:

  • https://github.com/eclipse-tycho/tycho/issues/5281
  • https://github.com/eclipse-tycho/tycho/issues/2462
  • https://github.com/eclipse-tycho/tycho/issues/1943
  • https://github.com/eclipse-tycho/tycho/issues/1322
  • https://github.com/eclipse-tycho/tycho/issues/1097
  • https://github.com/eclipse-tycho/tycho/issues/4555
  • https://github.com/eclipse-tycho/tycho/issues/3709
  • https://github.com/eclipse-tycho/tycho/issues/2432
  • ...

Also there are some issues with we need to keep up with changes in that plugin as well:

  • https://github.com/eclipse-tycho/tycho/issues/3247

Compared to that with modern JUnit, the benefits of surefire are not that big anymore and there are even native alternatives as well

  • https://github.com/sormuras/junit-platform-maven-plugin

Since a while we integrated even bnd-test framework that also controls the execution using native JUnit 5 inside an OSGi framework

  • https://tycho.eclipseprojects.io/doc/latest/tycho-surefire-plugin/bnd-test-mojo.html

One thing is that we support TestNG but I'm not aware of any bigger userbase for that:

  • https://github.com/eclipse-tycho/tycho/blob/tycho-5.0.x/RELEASE_NOTES.md#testng-support-improved--testng-deprecated

While it seems good to reuse the maven "native" approach it more becomes a burden than a benefit and hinders further development. I therefore would suggest to simply drop / deprecate that part and streamline the process, either support our use-case with the bnd-testing or adopt what the junit-platform-maven-plugin does and directly integrate with the junit platform that is defacto standard for Eclipse test execution anyways. This would best fit into a new tycho-testing-plugin to also allow better naming of mojos e.g. the bnd-testing is not really related to sure-fire and the current "test" are more related to plugin-tests in PDE than regular JUnit tests (that usually execute without OSGi).

There is also:

  • https://github.com/sormuras/junit-platform-isolator

laeubi avatar Sep 17 '25 05:09 laeubi

The most universal approach would be to make it a simple wrapper to the

https://docs.junit.org/current/user-guide/#running-tests-console-launcher

then we can call this completely classloader agnostic through ToolProvider

laeubi avatar Oct 09 '25 18:10 laeubi