如何配置 gradle 运行 JUnit4 测试使用 jupiter Junit5 平台的老式引擎进行类别测试
How to configure with gradle running JUnit4 tests with categories using vintage engine of jupiter Junit5 platform
当我们只有 JUnit4 测试时,我们使用了
test {
useJUnit{
excludeCategories "SlowTests"
}
}
现在迁移到 JUnit5 并且仍然有 JUnit4 测试,我们如何在 JUnitPlattform 中使用它来让标有 JUnit 测试类别的测试出来?
test {
useJUnitPlatform{
// ???
}
}
JUnit4 的类别根据 full class name of the category
映射到标签
所以以下应该有效:
tasks.test {
useJUnitPlatform {
includeTags.add("com.acme.Example")
// or the following to exclude the tag: includeTags.add("!com.acme.Example")
}
}
当我们只有 JUnit4 测试时,我们使用了
test {
useJUnit{
excludeCategories "SlowTests"
}
}
现在迁移到 JUnit5 并且仍然有 JUnit4 测试,我们如何在 JUnitPlattform 中使用它来让标有 JUnit 测试类别的测试出来?
test {
useJUnitPlatform{
// ???
}
}
JUnit4 的类别根据 full class name of the category
映射到标签所以以下应该有效:
tasks.test {
useJUnitPlatform {
includeTags.add("com.acme.Example")
// or the following to exclude the tag: includeTags.add("!com.acme.Example")
}
}