Running Geb Tests In Parallel

Aug 22, 2014

parallel linesBecause UI tests are inherently slow, running them in parallel--that is, running multiple tests, in multiple browsers concurrently--is all but a necessity.

Luckily, it's hilariously easy to run Geb tests in parallel, using Maven... all you need do is add the following code to you Maven pom.xml:

org.apache.maven.plugins
maven-surefire-plugin
2.17
 methods
    4
    4
    5
    true
    \*\*/\*Spec.\*

And then run your tests via Maven. Eg. mvn test -Dgeb.env=chrome . You can try it for yourself by running my geb-example on GitHub.

This code will spread your tests between up to 4 threads/forks and run tests at the method (test) level. You can also swap out "methods" for "classes" if you're prefer to run at the spec (class) level. Either way, you can dramatically speed up your automated tests with a few lines of code...

You did think about running tests in parallel when writing your tests... didn't you?