4

Can't figure out how to run Serenity web tests in parallel with gradle. Here is an example with maven + jenkins. But I need the same thing with gradle.

SLY
  • 525
  • 2
  • 11
  • 24

2 Answers2

4

you can do this by following the steps

Step 1: Create Suite file

Step 2: Enter the following task code in gradle

task runAParallelSuite(type: Test) {
    def forks =2
    exclude ('**/Library.java')
    println "The Maximum parallel is $forks"
    // uncomment maxParallelForks if you prefer to use the Gradle process forker
    // which also requires a complete change of how the suite class works
    maxParallelForks = forks
    include '**/**TestSuite.class'
    // testReportDir = file("${reporting.baseDir}/AParallelSuite")
    // testResultsDir = file("${buildDir}/test-results/AParallelSuite")
    // show standard out and standard error of the test JVM(s) on the console
    testLogging.showStandardStreams = true
}

now run the command in cmd prompt 'gradle clean runAParallelSuite aggregate'

selva
  • 1,175
  • 1
  • 19
  • 39
1

Here is another way to do this

   test {
       maxParallelForks=2
       options {
           systemProperties(System.getProperties())
       }
       ...
   }

maxParallelForks allows to set maximum number of forked test processes to execute in parallel with jUnit

SLY
  • 525
  • 2
  • 11
  • 24