Recall & Review
beginner
What is parallel execution in Selenium testing?
Parallel execution means running multiple tests at the same time to save time and get faster results.
Click to reveal answer
intermediate
How do you configure parallel execution in TestNG?
You set the 'parallel' attribute in the TestNG XML file to 'tests', 'methods', or 'classes' and specify 'thread-count' to control how many tests run at once.
Click to reveal answer
intermediate
Why is thread safety important in parallel execution?
Thread safety ensures that tests running at the same time do not interfere with each other, preventing errors and unreliable results.
Click to reveal answer
advanced
What is a common problem when running Selenium tests in parallel and how to fix it?
A common problem is sharing the same WebDriver instance across tests, causing conflicts. Fix it by creating a separate WebDriver instance for each test thread.
Click to reveal answer
beginner
Example of TestNG XML snippet to run tests in parallel by classes with 3 threads:
<suite name="Suite" parallel="classes" thread-count="3">
<test name="Test1">
<classes>
<class name="tests.TestClass1"/>
<class name="tests.TestClass2"/>
</classes>
</test>
</suite>Click to reveal answer
What does setting 'parallel="methods"' in TestNG XML do?
✗ Incorrect
Setting 'parallel="methods"' runs each test method in a separate thread at the same time.
Why should each test thread have its own WebDriver instance?
✗ Incorrect
Each thread needs its own WebDriver to prevent interference and errors during parallel execution.
Which TestNG XML attribute controls how many threads run in parallel?
✗ Incorrect
'thread-count' sets the number of threads to run tests in parallel.
What is a benefit of parallel execution in testing?
✗ Incorrect
Parallel execution speeds up testing by running multiple tests at the same time.
If tests share the same WebDriver instance in parallel, what can happen?
✗ Incorrect
Sharing WebDriver causes conflicts and unreliable test results.
Explain how to set up parallel execution in Selenium tests using TestNG.
Think about the XML configuration and how WebDriver instances relate to threads.
You got /4 concepts.
Describe common challenges when running Selenium tests in parallel and how to solve them.
Focus on what can go wrong when tests run at the same time.
You got /4 concepts.