Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I would like to run multiple Selenium Tests (on a Jenkins server) at the same time.

It currently runs only a single test at a time cause ChromeDriver seems to communicate over a special port. So somehow I guess I have to pass some kind of port settings via Selenium to the ChromeDriver to start up multiple tests.

The Selenium website, unfortunately, is empty for that topic:http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#parallelizing-your-test-runs

From my point of view it makes no difference if the Test runs locally or on Jenkins, the problem is the same. We need to somehow configure ChromeDriver. The question is just how.

Anybody has some ideas or pointers where to look at and what files are involved to get this done?

1 Answer

0 votes
by (62.9k points)

You can run multiple instances of chromedriver locally quite simply, just instantiate multiple driver objects, a chromedriver can keep the profiles separate and find a port to run all the instances by itself.

Here is a link to an example that can run multiple tests using TestNG and Maven:

https://github.com/prabhpreetk/Selenium-Maven-Template.git

Just clone the above project and run the following in the command-line interface:

mvn verify -Pselenium-tests -Dbrowser=chrome -Dthreads=2

It takes advantage of TestNG's ability to manage the thread pool and can open up multiple instances. You can do a similar thing with jUnit however you'll have to write down a custom test runner to fire the tests off into individual threads.

If you opt to use Gradle, it will deal with managing the thread pools for you with each TestNG and JUnit and a lot of developers prefer using maven.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium certification!

Browse Categories

...