我想为基于 JUnit-5 的测试类创建运行程序。
首先,我尝试使用这种结构。
@RunWith(JUnitPlatform.class)
@SelectClasses(UserAPITest.class)
public class UserAPITestRunner {
}
但在不起作用。如果我理解正确,那么在这样一个跑步者的帮助下,我可以运行基于 JUnit4 的。
我们如何运行套件 JUnit5 测试?
从技术上讲,如果您使用的@RunWith(JUnitPlatform.class)
是 JUnit 5 中的套件。它只是使用 JUnit 4 来启动 JUnit 5 平台。
从文档:
用@RunWith(JUnitPlatform.class) 注释的测试类和套件不能直接在 JUnit 平台上执行(或作为某些 IDE 中记录的“JUnit 5”测试)。此类类和套件只能使用 JUnit 4 基础结构执行。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句