Book Image

Learning Selenium Testing Tools - Third Edition

Book Image

Learning Selenium Testing Tools - Third Edition

Overview of this book

Table of Contents (22 chapters)
Learning Selenium Testing Tools Third Edition
About the Author
About the Reviewers

Running tests in parallel

So far we have managed to get our tests cycling through different machines. We also got it working against the Selenium Grid hub so that we can see all of our tests being split out to the machines and make sure that we test against browser and operating system combinations.

In this section, we will look at how we can add a thread-count attribute to the <suite> node in our test configuration file. We will also need to add the parallel attribute to the test suite. The value that it takes will either be methods or classes. This will mean that either the methods—the test cases—are run in parallel, or the classes that contain the test cases are running in parallel.

Getting our tests running in parallel

Now, we are ready to have our tests running in parallel:

  1. Open your TestNG XML configuration file.

  2. Add parallel=methods to the suite node.

  3. Add thread-count=3 to the suite node. This will run your tests with three threads. This number can be any value that you want. It is...