0

I want to the Test Suites parallel from maven. my pom.xml looks like below:

<profiles>
        <profile>
            <id>API_AUTOMATION</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.19.1</version>
                        <configuration>
                            <parallel>suites</parallel>
                            <threadCount>8</threadCount>
                            <suiteXmlFiles>
                                <!-- TestNG suite XML files -->
                                <suiteXmlFile>./module1.xml</suiteXmlFile>                              
                             <suiteXmlFile>./module2.xml</suiteXmlFile>
                            </suiteXmlFiles>
                            <testSourceDirectory>src/main/java</testSourceDirectory>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
</profiles>

all the .xml files are TestNG file which are Test Suites. please let me know, how to run the suites in parallel.

Sarada Akurathi
  • 1,164
  • 7
  • 28
  • 56
  • Please add an error description to your question by editing. Though the [Surefire documentation](http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html#Running_Tests_in_Parallel) says it should be `` not `` it works in my test (probably an error, in the beginning it says `` too). The rest looks OK too. – try-catch-finally Jul 12 '17 at 04:40
  • i ran the test using the following command `mvn clean test -Dmaven.test.failure.ignore=true -Djdk.level=1.7 -P API_AUTOMATION` but it didn't run the test parallel, it ran in sequential order. – Sarada Akurathi Jul 12 '17 at 10:47
  • 1
    You can try with 8 property and don't set thread count property or set it as 0. – Murthi Jul 14 '17 at 12:50
  • @Murthi, could you please keep your comment as answer, i will accept it - Thanks Sarada – Sarada Akurathi Jul 31 '17 at 17:08

2 Answers2

2

You can try with <threadCountSuites>8</threadCountSuites> property and don't set thread count property or set it as 0.

Murthi
  • 5,299
  • 1
  • 10
  • 15
1

Parallelmode "suites" is not supported by TestNG, neither via Surefire nor through any run type of TestNG.

From the command line options in the documentation:

-parallel    methods|tests|classes    If specified, sets the default 
                                      mechanism used to determine how 
                                      to use parallel threads when 
                                      running tests. If not set, 
                                      default mechanism is not to use 
                                      parallel threads at all. This can 
                                      be overridden in the suite 
                                      definition.

The proof can be found in the v6.11 sources of XmlSuite:

public class XmlSuite implements Serializable, Cloneable {
  /** Parallel modes */
  public enum ParallelMode {
    TESTS("tests", false), METHODS("methods"), CLASSES("classes"), INSTANCES("instances"), NONE("none", false),

    ...
  }
  ...
}

This applies to TestNG 6.11 and older versions.

Consider adding the tests from multiple .xml files into one .xml file with multiple <test> nodes and define the parallelism in the testng.xml to be tests.

try-catch-finally
  • 7,436
  • 6
  • 46
  • 67