如何在gradle中的测试任务中指定@category? [英] How to specify @category in test task in gradle?
问题描述
我想知道我是否可以在gradle测试任务中指定@category。所以,我可以运行单独的集成junit和正常的junit测试。
我知道目前有在gradle中没有对@category的显式支持,我正在寻找解决此限制的解决方法。
直接的方法是为不同的测试类别定义测试套装,例如。我希望在我的gradle脚本中指定@category。
支持包含或排除类别已包含在gradle中: / p>
test {
useJUnit {
includeCategories'org.gradle.junit.CategoryA'
excludeCategories 'org.gradle.junit.CategoryB'
}
}
完整文档:
http://www.gradle.org/docs/current/userguide/java_plugin .html#test_grouping
I would like to learn whether I can specify the @category in gradle test task. So, I can run separately integration junits and the normal junit tests.
I know that there is currently no explicit support for @category in gradle and I am looking for a workaround for this limitation.
The straightforward approach is to define test suits for different test categories, e.g., How to run all tests belonging to a certain Category in JUnit 4. I would prefer to specify @category in my gradle script.
Support for including or excluding categories has been included in gradle:
test {
useJUnit {
includeCategories 'org.gradle.junit.CategoryA'
excludeCategories 'org.gradle.junit.CategoryB'
}
}
Full documentation: http://www.gradle.org/docs/current/userguide/java_plugin.html#test_grouping
这篇关于如何在gradle中的测试任务中指定@category?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!