I was wondering if there is a way to run multiple test suites in parallel with TestNG + Gradle.
I have a master suite file which contains other individual suites to run, however it will only run the suites sequentially. I currently run tests inside individual suites in parallel but I also need to set multiple suites to run at the same time as-well.
Example master suite file:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="debug suite">
<suite-files>
<suite-file path="debug-test.xml"></suite-file>
<suite-file path="debug-test.xml"></suite-file>
<suite-file path="debug-test.xml"></suite-file>
<suite-file path="debug-test.xml"></suite-file>
<suite-file path="debug-test.xml"></suite-file>
</suite-files>
</suite>
Example suite file containing a test:
<suite name="Debug suite" verbose="1" parallel="tests" thread-count="2" data-provider-thread-count="1">
<test name="example test 1">
<classes>
<class name="ExampleTest"/>
</classes>
</test>
<test name="example test 1">
<classes>
<class name="ExampleTest"/>
</classes>
</test>
</suite>
I run my tests using this gradle task in my build.gradle:
ask runSuite(type: Test, dependsOn: ['clean', 'classes']) {
def suite = System.properties["suite"]
useTestNG() {
suites "src/test/suite/" + suite
}
testLogging.showStandardStreams = true
}
I have seen that testNG has a parameter '-suitethreadpoolsize' that would achieve what I want but its not supported when using Gradle. Does Testng + Gradle support this kind of behaviour?
Resolved to programmatically extract tests from all child suites in the master suite and place them into one suite, then run those in parallel.
Not ideal but fits my use case.