Creating and executing the Selenium script in parallel with TestNG
Now that we have our Selenium Grid Hub and nodes ready and configured from previous recipes, it's time to run tests in parallel with this distributed environment.
To run tests in parallel, we need a test framework that supports distributing tests on these nodes. We will use TestNG to run tests in parallel for Selenium tests developed with Java bindings.
TestNG (http://testng.org) is another popular unit testing frameworks used by the Java community after JUnit. TestNG allows us to create tests that can be executed in parallel. We can set up a group of tests or test suites and have parameters configured to run these tests in parallel. It uses a multithreading model to run tests in parallel.
TestNG requires that we have an XML configuration file with details of configurations that are needed to run the tests in parallel. Before starting the run, TestNG reads this configuration file to set up the test.
In this recipe, we...