Run your Selenium driven tests in parallel using TestNG.

Sometime ago I came across this post:
And I thought it’d be good to have it in a repo to save you time setting up your own project.

Basically this example project runs JUnit tests in parallel using TestNG.
Tests are grouped by the browser in which they’re going to be executed (have a look at the TestNG XML Suite files in src/test/resources).
As you might have guessed to drive the browsers we use Selenium WebDriver 🙂
And of course you can run your tests locally or remotely using Selenium GRID.

You can find the repo here:

And here’s a video showing this project in action 🙂

2 thoughts on “Run your Selenium driven tests in parallel using TestNG.

  1. Hello Janusz, I hope you are doing well.

    This is a great project, really helped me to apply some needed stuff.
    I just have two problems even when running your own code, if you can help that would be great.

    1- Tests are not running in FF, I tried different versions of FF and Selenium however I still get the same issue. When I run the tests on firefox it opens the browser to the mozilafirefox main page and stop, it don’t complete my own tests.
    Console error is “org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
    stem-defaults”:{“”:{“d”:”C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\”,”e”:true,”v”:”1.0″,”st”:1466734942000},””:{“d”:”C:\\Program Files (x86)\\Mozilla”
    I tries some online solutions as using different versions of FF or SElenium server.
    I tried with FF43.0, 47.0.1 and 48.0.2…and Selenium server 3.0.0-beta3, 2.53.1 and 2.47.1

    2- I included IE on my parallel browsers, when I run the code the IE browser opens and close just once quickly without doing any tests, and it gives me the following console error: “cucumber.runtime.CucumberException: org.openqa.selenium.WebDriverException: Failed to navigate to http://fvstaging:24$ This usually means that a call to the COM method IWebBrowser2::Navigate2() failed. (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 14 milliseconds
    Build info: version: ‘2.41.0’, revision: ‘3192d8a6c4449dc285928ba024779344f5423c58’, time: ‘2014-03-27 11:29:39″”

    Could you help here? If any more details needed tell me.

    • Hi Tarek,
      I haven’t looked into comments on this blog for couple of years.
      I’m sorry but won’t be able to help you. I’ve switched from Java to Python more than 5 years ago and haven’t touched that code since then.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s