Cannot include/exclude Junit tests classes by Category using gradle

拜拜、爱过 提交于 2019-12-02 01:11:40

This works for me with Gradle 2.12. I don't know what is different between our respective environments, but I have placed my solution on GitHub for reference.

Note that I have placed FastTest.java and SlowTest.java in the src/test/java/net/codetojoy folder, where the tests reside.

I found the problem myself. I missed the fact that

High extends Low

so the exclusion correctly affected all annotated tests. The extension is intended and the correct pattern in build.gradle would simply be:

useJUnit {
    includeCategories 'testclient.priority.High'
}

In fact there are five priority levels and the extension dependency is an easy way to configure something like "run everything of this level or higher".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!