When I am running a test using Gradle the test will run multiple times. Actually it is running the same amount of times as the number of suites covering that test.
So when running:
gradle test --tests com.mycompany.test.SomeTest
The test will run 3 times. see the following example:
public class SomeTest {
@Test
public void test() {
System.out.println("SomeTest.test --");
}
}
@RunWith(Suite.class)
@Suite.SuiteClasses({SomeTest.class})
public class SomeSuit1 {}
@RunWith(Suite.class)
@Suite.SuiteClasses({SomeTest.class})
public class SomeSuit2 {}
The output will be:
shay$ gradle test --tests com.mycompany.test.SomeTest
Starting a Gradle Daemon, 2 busy Daemons could not be reused, use --status for details
:compileAspect UP-TO-DATE
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestAspect
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
Done cleaning report folder [reports]
com.mycompany.test.SomeSuit1 > com.mycompany.test.SomeTest.test STANDARD_OUT
SomeTest.test --
com.mycompany.test.SomeSuit2 > com.mycompany.test.SomeTest.test STANDARD_OUT
SomeTest.test --
com.mycompany.test.SomeTest > test STANDARD_OUT
SomeTest.test --
BUILD SUCCESSFUL
Total time: 20.219 secs
How can I run this specific test only one time?