We have created a custom test runner for Junit 5. However, we would like to stop this runner after the first failing test. I've looked into Extensions, but these all work with ExtensionContext
which does not seem to provide any way to stop the runner.
How can I stop the runner after a failed test?
For various reasons this is currently not supported by the junit-platform. Have a look at this issue: https://github.com/junit-team/junit5/issues/1729
So the only option you have is to use
System.exit()
. Be prepared, though, to run into misbehaving IDEs and build tools.