Stopping test runner after first failing test

112 views Asked by At

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?

1

There are 1 answers

0
johanneslink On BEST ANSWER

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.