mibutec
mibutec

Reputation: 2997

What's the JUnit 5 way for RunListeners

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?

Upvotes: 7

Views: 9242

Answers (1)

Sormuras
Sormuras

Reputation: 9089

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

Upvotes: 12

Related Questions