Howto prevent execution of JUnit Suites altogether?

Viewed 38

We are moving from our own proprietary java build tool to gradle.

Our own tool uses ANT and a custom org.apache.tools.ant.types.selectors.BaseExtendSelector to pull all things annotated with JUnit's @Test, resulting in some 4400 tests.

Running gradle test, I found some 5000 tests were run.

Further investigation revealed that we we have various usages of JUnit's @Suite:

@RunWith(Suite.class)
@Suite.SuiteClasses({
   FooTest.class,
   BarTest.class, ...
})
public class FooBarSuite {
}

where the listed tests FooTest, ... are all "ordinary" unit tests annotated with @Test. So the problem is that gradle "finds" all @Tests, but also all @Suites, and thus runs these twice.

Thus: is there a mechanism in gradle to simply ignore all the @Suite classes from execution (without specifying them manually by name)?

Note: I do know about JUnit categories, but that approach would require to rework our code base here. I am looking for a solution that works without editing all the suits.

0 Answers
Related