Parallel testing
When testing browser or mobile applications, it is often necessary to test on multiple browser types or mobile devices. That can be accomplished in this framework by changing the XML suite file parameters, but it is time consuming to do cross-browser and mobile testing in serial mode. Using the TestNG suite XML parallel features and the Java ThreadLocal
class for property file initialization, users can design a setup class that will instantiate the driver in parallel. Let's look at each function in detail.
Note
The TestNG documentation on parallel testing is located at http://testng.org/doc/documentation-main.html#parallel-running.
Suite XML file
The TestNG suite tag has several attributes that control parallel testing. Those attributes are:
parallel = "false/tests/classes/methods/instances"
thread-count = "number"
For these parallel attributes, users can run in single-threaded mode using a value of false
, or select one of the other modes depending on whether they want to run a...