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

2
  • Do they run in sequence ? Commented Aug 20, 2021 at 15:41
  • They don’t run in sequence also.. Commented Aug 20, 2021 at 15:47

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

1 Comment

Thank you Lewis, I have tried this and didn't work apparently.
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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.