I have created a project that contains multiple modules. In my parent pom.xml I added a surefire plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>MyTestSuite.xml</suiteXmlFile>
</suiteXmlFiles>
<threadCountSuites>16</threadCountSuites>
<threadCountClasses>8</threadCountClasses>
<threadCountMethods>8</threadCountMethods>
</configuration>
</plugin>
Each module contains its own testngsuite.xml file that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="ModuleATests">
<classes>
<class name="com.home.Test1"/>
<class name="com.home.Test2"/>
<class name="com.home.Test3"/>
</classes>
</test>
<listeners>
<listener class-name="com.home.MyListener"/>
</listeners>
</suite>
I would like to execute modules A,B and C in parallel (so all tests in module A have to run sequentially but in parallel with tests from modules B and C). How to achieve it? I have tried many ways but they keep running module after module.
For example, as you can see, I've created an additional file called MyTestSuite.xml (on the same level that I have the parent pom.xml file) to achieve a suite of suites approach:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="My Custom suite" parallel="classes">
<suite-files>
<suite-file path="modules/A/testngsuite.xml"/>
<suite-file path="modules/B/testngsuite.xml"/>
<suite-file path="modules/C/testngsuite.xml"/>
</suite-files>
</suite>
and when running mvn clean test I have an error saying that maven tries to find MyTestSuite.xml in modules A, B and C: modules/A/MyTestSuite.xml is not a valid file