0

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.

Sean Mickey
  • 7,618
  • 2
  • 32
  • 58
Monis Majeed
  • 1,358
  • 14
  • 21

3 Answers3

1
          <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>
Monis Majeed
  • 1,358
  • 14
  • 21
1

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.

Community
  • 1
  • 1
tim-slifer
  • 1,068
  • 1
  • 9
  • 17
  • I did not know you could do that! Nice, I may actually implement that. How does the test report look? All on one report just broken down into Suites > Packages > Tests ? – Ray Sep 23 '16 at 00:39
1

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>
Amit Bhoraniya
  • 621
  • 3
  • 14