我需要运行一些集成测试和一些单元测试,我使用的是spring,gradle和jUnit 4.
我使用了jUnit类@Category(UnitTestCategory.class)和@Category(IntegrationTestCategory.class)并添加了i
test {
useJUnit {
includeCategories 'org.gradle.junit.CategoryA'
excludeCategories 'org.gradle.junit.CategoryB'
}
}
用于gradle以包含/排除类别.我的想法是,我不想混合单元测试和集成测试,我有一个类别.
问题是我必须使用spring和categories,而@RunWith(…)只能接收一个类param. – RunWith(SpringJUnit4ClassRunner.class)或@RunWith(Categories.class).
我无法使用@RunWith({Categories.class,SpringJUnit4ClassRunner.class}),我必须运行spring和categories.再加上未来我可能还需要添加其他类,不仅仅是spring和category.所以我需要@RunWith(…)的多个参数
https://docs.gradle.org/current/userguide/java_plugin.html
有人有解决方案吗?
最佳答案
您可以使用spring junit rules而不是春季跑步者.然后作为跑步者,您可以使用类别
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。