0

I'm working on a mobile automation task where I need to run test suites in parallel for 3 different iOS apps. Each test suite has its own testng.xml with a section configured to run on a device.

I tried mvn clean test -Dthreads=3 -Dsuites=full path 1 to the suite, full path 2 to the suite, full path 3 to the suite

Here threads and suites are properties defined in pom.xml. It looks like the suiteXMLFile in pom.xml cannot take absolute path. It works fine, when I do: mvn clean test -Dthreads=1 -Dsuites=src/test/resources/testng.xml.

How do I run the suites on all 3 devices in parallel with the test suites lying in 3 different folders pointing to 3 different devices?

Appreciate help.

0

From TestNG documentation:

5.11.1 - Parallel suites

This is useful if you are running several suite files (e.g. "java org.testng.TestNG testng1.xml testng2.xml") and you want each of these suites to be run in a separate thread. You can use the following command line flag to specify the size of a thread pool:

java org.testng.TestNG -suitethreadpoolsize 3 testng1.xml testng2.xml testng3.xml

The corresponding ant task name is suitethreadpoolsize.

To set this up using Maven Surefire Plugin (as shown in their examples):

</plugins>
    [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.21.0</version>
        <configuration>
          <suiteXmlFiles>
            <file>${suite1}</file>
            <file>${suite2}</file>
            <file>${suite3}</file>
          </suiteXmlFiles>
          <properties>
            <property>
              <name>suitethreadpoolsize</name>
              <value>${threads}</value>
            </property>
          </properties>
        </configuration>
      </plugin>
    [...]
</plugins>

Then the command line would be:

mvn clean test -Dthreads=3 -Dsuite1=<full path 1 to the suite> -Dsuite2=<full path 2 to the suite> -Dsuite3=<full path 3 to the suite>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.