Given the following JUnit tests, surefire will run TestA
and TestB
twice. The first time a individual tests, and the second time as part of the test suite.
It seems an unwanted behaviour. In fact popular IDE such as IntelliJ will just run the test once as part of the test-suite.
Is this a bug? Is there a way to configure surefire-plugin to run these thest only as part of a test-suite?
Sample Project available on GitHub
@RunWith(Suite.class)
@Suite.SuiteClasses({TestA.class, TestB.class})
public class TestSuite
{}
public class TestA {
@Test
public void test() {
System.out.println("=== RUN " + this.getClass());
}
}
public class TestB {
@Test
public void test() {
System.out.println("=== RUN " + this.getClass());
}
}