Execute Tests in Parallel
Ekam’s Gradle task has been configured to execute tests in parallel by default. 2 tests precisely
threadCount Integer.parseInt(System.getProperty("sessions", "2"))
However, this behavior can be changed by modifying the task.
task runWebTests(type: Test) {
filter {
excludeTestsMatching "*.mobile.*"
excludeTestsMatching "*.api.*"
excludeTestsMatching "*.db.*"
}
outputs.upToDateWhen { false }
useTestNG {
parallel = "methods"
threadCount Integer.parseInt(System.getProperty("sessions", "2"))
includeGroups System.getProperty("tags", "web")
testLogging.showStandardStreams = true
useDefaultListeners true
outputDirectory = file("$buildDir/" + System.getProperty('tags', 'NONE'))
}
}
An example of Execute 3 tests in parallel in Selenoid
Let us create 3 tests
Modify gradle task to as below:
threadCount Integer.parseInt(System.getProperty("sessions", "3"))
Execute gradle task
./gradlew clean runWebTests -Dconfig=selenoid.local
NOTE: Executing docker containers locally could be resource-intensive. Recommended is to have the Selenoid Hub in a cloud virtual machine.