简体   繁体   English

如何使用 jupiter Junit5 平台的老式引擎运行带有类别的 JUnit4 测试的 gradle 配置

[英]How to configure with gradle running JUnit4 tests with categories using vintage engine of jupiter Junit5 platform

When we had only JUnit4 tests, we used当我们只有 JUnit4 测试时,我们使用

test {
    useJUnit{
        excludeCategories "SlowTests"
    }
}

Now migrating to JUnit5 and still having JUnit4 tests around, how do we use it in JUnitPlattform to let tests marked with a JUnit test category out?现在迁移到 JUnit5 并且仍然有 JUnit4 测试,我们如何在 JUnitPlattform 中使用它来让标有 JUnit 测试类别的测试退出?

test {
    useJUnitPlatform{
        // ???
    }
}

JUnit4's categories are mapped to tags according to the full class name of the category JUnit4的类别根据类别的完整类名映射到标签

So the following should work:所以以下应该工作:

tasks.test {
    useJUnitPlatform {
        includeTags.add("com.acme.Example")
        // or the following to exclude the tag: includeTags.add("!com.acme.Example")
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM