how do you execute tests in parallel using TestNG?

by (171 points)
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by (171 points)
0 votes

In testNG.xml file,


<suite name="Test-method Suite" parallel="methods" thread-count="2" >
We have attribute called paralle, which allows you to execute tests in parallel, it has options such as "methos", "classes" and "tests".
"Methos" - this will execute each @Test method in parallel
"Classes" - This will execute each class in parallel, Test methods inside class in sequential.
"Tests" - This will execute each <test> node in parallel.
"thread-count" attribute can help you control how many tests to be execute in parallel.