在我们的环境中,我们使用JUnit 4 TestListener
将测试结果报告给远程服务器。
JUnit 5的做法是什么?
答案 0 :(得分:6)
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’sjava.util.ServiceLoader
facility are automatically registered with theDefaultLauncher
.
"JUnit 5", read the JUnit Platform, ships some example listeners. You can view their source here: