I have a multi-module Maven project. In the root pom.xml, I have added the following...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<parallel>methods</parallel>
<threadCount>100</threadCount>
</configuration>
</plugin>
The command mvn test will cause each module to be built (if needed) and then the tests for that module will be run in parallel. Once all of the tests are done, Maven starts working on the next module. Maven will work on each module sequentially.
Inside, Eclipse IDE I can run TestNG against a suite called testng.xml. This file specifies that all packages should be run in parallel. This causes TestNG to run all test methods across all modules in parallel. This is exactly what I want to do but I am not sure how. A benefit of this is that all of the tests are run in 1 process and can share state between them. This state sharing speeds up the tests quite a lot. Note: I thought about using ant to execute a command but then I wasn't sure how to specify a classpath with the dependencies from the Maven repository.
mvn -T 8 test will allow for parallelism but because of dependencies between the modules I don't get all of the tests run in a parallel. I would be okay with running mvn compile test-compile -DskipTests=true first and then running mvn -T 8 test if this would run all of the tests in parallel.
Edit: The tests run are a mixture of unit and integration tests. With the option -Dgroups=, I can pick which set of tests are executed.
mvn -T 8 test- KeatsPeeks