7

In our environment we are using JUnit 4 TestListeners to report test results to a remote server.

What is the JUnit 5 way doing that?

1 Answer 1

12

You may use a TestExecutionListener:

http://junit.org/junit5/docs/current/user-guide/#launcher-api-listeners-custom

7.1.4. Plugging in Your Own Test Execution Listeners

In addition to the public Launcher API method for registering test execution listeners programmatically, custom TestExecutionListener implementations discovered at runtime via Java’s java.util.ServiceLoader facility are automatically registered with the DefaultLauncher.

"JUnit 5", read the JUnit Platform, ships some example listeners. You can view their source here:

https://github.com/junit-team/junit5/tree/HEAD/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.