在我们的环境中,我们使用 JUnit 4 TestListener
向远程服务器报告测试结果。
JUnit 5 是如何做到这一点的?
最佳答案
您可以使用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”,请参阅 JUnit 平台,提供了一些示例监听器。您可以在此处查看其来源:
关于junit5 - RunListeners 的 JUnit 5 方式是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48595037/