gpt4 book ai didi

junit5 - RunListeners 的 JUnit 5 方式是什么

转载 作者:行者123 更新时间:2023-12-01 16:24:08 26 4
gpt4 key购买 nike

在我们的环境中,我们使用 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’s java.util.ServiceLoader facility are automatically registered with the DefaultLauncher.

“JUnit 5”,请参阅 JUnit 平台,提供了一些示例监听器。您可以在此处查看其来源:

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

关于junit5 - RunListeners 的 JUnit 5 方式是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48595037/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com