Setting up parallel tests for selenium automation

Hi all,

Currently, we have selenium automation framework set up where tests are being executed from command line and we are looking to add parallel testing to the framework. We want to use BrowserStack for our parallel testing but we are having few difficulties. Our requirements:

We want to be able to run a single test or test suite on the specific browser locally but not in parallel mode.
We want to be able to run a single device or browser on BrowserStack from a JSON file, also not in parallel.
Finally, we want to run all devices specified in JSON file in parallel.

I was able to achieve parallel testing but to move from parallel and non-parallel testing requires editing config file which is not an ideal approach for us. I was wondering, maybe somebody had a similar issue or knows a clever way which would allow us to achieve all of these requirements without having to edit the config file every time?

Automation framework is written in Java and we are using JUnit5 to run our tests.

Thank you.


I have a couple of examples for you.

First of all there is this template that uses TestNG:

Ardesco/Selenium-Maven-Template: A maven template for Selenium that will let you check out and go.

I also have a JUnit branch (which is a bit older and slightly out of date), however it’s currently using JUnit 4.12:

Ardesco/Selenium-Maven-Template: JUnit branch (

The code in DriverBase is really what sets up the thread pools, so it’s what is of main interest. Hopefully the above gives you enough of a pointer in the right direction that you can easily slide a JUnit5 implementation in without too much effort.