0
votes

I have two TestNG test suite XML files, each suite has two classes, and I want to run both suites in parallel.

I don't want to run methods or classes in parallel; I want to run the suites in parallel using TestNG, because each suite has its own config parameters.

3

3 Answers

1
votes
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <suiteXmlFiles>
                    <file>Suite1.xml</file>
                    <file>Suite2.xml</file>
                </suiteXmlFiles>
                <properties>
                    <property>
                        <name>suitethreadpoolsize</name>
                        <value>2</value>
                    </property>
                </properties>
            </configuration>
        </plugin>
1
votes

I'd recommend a Suite-of-Suites configuration. Please see my answer here.

From your surefire plugin, you'd simply need to invoke your master suite file instead of each one individually.

1
votes

Instead of executing suites files in parallel, create two test suites in one xml and set parallel="tests".

And specify your parameters inside <test> </test> tags, below is an example.

<suite name="Demo Suite" parallel="tests">        
        <test name="TestSuite1">
            <parameter name="driver.name" value="firefoxDriver" />
            <classes>
                <class name="com.example.Demo1" />
            </classes>
        </test>
        <test name="TestSuite2">
            <parameter name="driver.name" value="chromeDriver" />
            <classes>
                <class name="com.example.Demo2" />
            </classes>
        </test>
</suite>