I’ve some test clases that’re part of a JUnit suite and hence running the suite runs them automatically. However, Gradle seems to be running them twice, presumably once as part of the JUnit suite and another as independent test files. I created a JUnit category and excluded that in the build file. However, now the classes are not executed at all - Gradle ignores the fact that the classes should still run as part of the JUnit suite.
The following does not work.
interface CDISuiteTest {
}
@org.junit.experimental.categories.Category(CDISuiteTest)
class MovieRipServiceTest {
@RunWith(Categories)
@Categories.IncludeCategory(CDISuiteTest)
@Suite.SuiteClasses([
MovieIndexAndSearchServicesTest,
MovieRipServiceTest
])
class CDITestSuite {
test {
// Exclude integration tests and tests part of JUnit suites
useJUnit {
excludeCategories 'name.abhijitsarkar.moviemanager.util.CDISuiteTest'
}
includes = ['**/CDITestSuite*', '**/Test*'] as Set
}