我有尝试与JUnit 5 Vintage一起运行的JUnit 4测试。
我在嵌套的静态类中有很多测试。顶级类中的测试运行良好,但嵌套类中的测试无法运行。
例如:
public class SomeOuterClass {
@Test
public void outerTest() {
// test runs
}
public static class SomeInnerTests {
@Test
public void someTest() {
// test doesn't run
}
}
public static class OtherInnerTests {
@Test
public void otherTest() {
// test doesn't run
}
}
}
我尝试设置junitPlatform.filters.includeClassNamePatterns
为,'^.*Tests?$', '^.*Tests?\$.*$'
但没有成功。
JUnit 5 Vintage在最终版本中增加了对运行嵌套静态类的支持。
默认情况下,它仅查找名称以“ Test(s)”结尾的类。要包括没有这样命名的嵌套静态类,请在构建文件中设置以下内容。
junitPlatform.filters.includeClassNamePatterns '^.*Tests?$', '^.*Tests?\\$.*$'
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句