And I have this also in build file:
tasks.withType(Test) {
useTestNG(){ }
}
Can I run testsA & testsB in parallel.
I tried using maxParallelForks = Runtime.runtime.availableProcessors() / 2 but this eventually run multiple tests within same task (let say testsA) in parallel.
What I am looking for is to run testsA & testsB simultaneously in parallel.
Task level parallelism is unsupported and undocumented feature that can easily cause unreproducible build failures unless you are very careful. There is a hidden flag to enable it, but you shouldn’t use it. I think they are going to bring it for real when Gradle transitions to the new configuration model.
What is your issue with having each test task execute the actual tests in parallel (i.e. why is maxParallelForks not sufficient for what you need)?
As of now Gradle does not support running tasks within the same project in parallel.
The best you can do is to try to reframe your requirement. Alternatively, you will spend a lot of time fighting the tool and your colleagues will hate you when they have to maintain that build few years from now.
One way to do that is to merge the two test tasks, so they get parallelized. The downside is that then you can’t run one without the other.
More sophisticated (and obfuscated) way to do that is to change the build 2 empty tasks finalized by the test task and configure the test roots based on which of the test tasks are present in the TaskGraph. I would avoid this kind of things if possible and rather wait for the tool to provide the functionality (hopefully soon with Gradle 3.x).
This is the only (fully experimental) way of doing this atm. If you don’t see those tasks been executed in parallel you might have a dependency declared among them?
@manoj7shekhawat Did you managed to find a way how to run specific XML test suite from command line? I tried your way and it gives me an error. Also you are using "reports.junitXml.destination = “$buildDir/results/A” with a TestNG framework.