Talking testing, automation... and anything else.

Running Geb Tests In Parallel

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:

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?

Plusone Linkedin Facebook Twitter Digg Email


  1. Can you please give more details on how you suggest to run Geb tests in parallel in multiple browsers? Is there a way to specify multiple environments for one suite using Geb+Spock+Maven?

  2. Mahantesh Hallur

    Hi Brian,

    I want execute tests in parallel mode (Geb,TestNG & Maven Stack), but when i tried to do,its always typing in single instance, Could you help me how can i achieve that. How to open multiple browsers in Geb (As of now from GebConfig i am able to create one instance of any browser(Chrome,Firefox,Safari etc..). The same could be done in selenium just by creating instance to different browser. Please help out how i can i do it Geb.


    • Hi Mahantesh,

      I seem to remember reading that TestNG handles parallel runs differently? I don’t use TestNG, so StackOverflow is your best bet :) Sorry I couldn’t be more help.

  3. Hi Brian,

    How to add this plugin in gradle.

    Thank you,

  4. Hi Mahantesh,
    Did you solve the problem of running tests in parallel using Geb TestNg and Maven. From GebConfig I am able to create only one instance.

Leave a Reply to sam Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.