0

I am trying to run my tests in parallel with Maven by using 2 xml files but it doesn't seem to work. I have tried the steps/parameters from the Maven documentation: http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html

Below is my pom.xml file:

                    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M5</version>
                    <configuration>
                        <suiteXmlFiles>
                            <suiteXmlFile>feature1.xml</suiteXmlFile>
                            <suiteXmlFile>feature2.xml</suiteXmlFile>-->
                        </suiteXmlFiles>

and this is the feature1.xml file:

<suite name="tests">
    <test name="feature1" group-by-instances="true">
        <parameter name="browser" value="chrome"/>
        <classes>
            <class name="testclass"/>
        </classes>
    </test>
</suite>

What parameters/changes I should make in order for this to work?

Thank you

vladys2019
  • 39
  • 6

3 Answers3

1

I am posting the solution that I found and it worked after all:

I have added this in the configuration node:

<properties>
<property>
<name>suitethreadpoolsize</name>
<value>2</value>
</property>
</properties>    

Also the issue was that I was using a static WebDriver (Singleton class), the reason why the tests didn't run in sequence. I have made the method WebDriver public and instantiate it in every test class runner. Now the tests are running in parallel successfully.

vladys2019
  • 39
  • 6
0

Add

<parallel>suites</parallel>

and

<threadCount>8</threadCount>

to the configuration node of your pom file. the parallel tag tells maven to run the suites in parallel and thread count tells maven how many parallel threads to run at a time.

Lewis Ayers
  • 43
  • 1
  • 5
0

You can also config in xml file itself, parallel="true" thread-count="8"

<test name="Basic validation" parallel="true"  thread-count="8">
    <classes>
         <class name="Pages.Scenarios.AccumulationTestCases"/>
        <class name="Pages.Scenarios.ScenarioTestCases"/>
        <class name="Pages.Scenarios.AlertScenarios"/>
        <class name="Pages.Alert.AlertTestCases"/>
        <class name="Pages.Scenarios.DummyTest"/>
    </classes>
</test>
Jayanth Bala
  • 758
  • 1
  • 5
  • 11