My Question is similar to this question , but it refers to Gradle
not Maven
.
I have marked several tests within my project with the @Category
annotation, and created my Test Suite (See below).
How do I run this using Gradle?
Test Suite:
@RunWith(Categories.class)
@Categories.IncludeCategory(MyTestSuite.class)
@Suite.SuiteClasses(ClassUnderTest.class)
public interface MyTestSuite {
}
I suppose, you need something like this, according to JUnit wiki :
Gradle's test task allows the specification of the JUnit categories you want to include and exclude.
test { useJUnit { includeCategories 'org.gradle.junit.CategoryA' excludeCategories 'org.gradle.junit.CategoryB' } }
Configuration above is example of global tests configuration, but you can create a custom test task to run specific test categories, as follows:
task customTest(type: Test) {
useJUnit {
includeCategories 'some.package.name.MyTestSuite'
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.