Problem: When I run "mvn test" in the command line JUnit is not running my tests in parallel. Below is my entry into the pom for the surefire plugin to facilitate parallel. I am using Junit 4.12
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>false</skip>
<parallel>methods</parallel>
<threadCount>4</threadCount>
</configuration>
</plugin>
Essentially I have a series of dumb tests just to make sure threading is working correctly
@RunWith(Parameterized.class)
public class JunitTest {
Container container = new Container();
@Parameterized.Parameters
public static List<Object[]> data() {
return Arrays.asList(new Object[10][0]);
}
@Test
public void test1(){
Assert.assertTrue(container.something().childVal.equals("initial"));
System.out.println("running test 1 on thread " + Thread.currentThread().getId());
container.something().childVal = "dirty";
}
// basically several copies of this test after this
When the tests are ran I would expect that I would see different thread ID's being output.