Setting parallel="tests" means TestNG runs multiple <test> tags at the same time.
Step 2: Check thread-count value
thread-count="3" limits the number of simultaneous threads to 3, so max 3 tests run together.
Final Answer:
3 tests run simultaneously -> Option A
Quick Check:
parallel=tests + thread-count=3 means 3 parallel tests [OK]
Hint: thread-count limits max parallel tests [OK]
Common Mistakes:
Assuming all tests run at once ignoring thread-count
Confusing parallel="methods" with parallel="tests"
Thinking thread-count is ignored
4. You configured TestNG with parallel="methods" and thread-count="2". Your tests share a static WebDriver instance. What problem will most likely occur?
medium
A. Tests will fail due to WebDriver conflicts from shared instance.
B. Tests will run faster without any issues.
C. Tests will run sequentially ignoring parallel settings.
D. Tests will create multiple WebDriver instances automatically.
Solution
Step 1: Understand parallel methods with shared static WebDriver
Parallel methods run at the same time, but sharing a static WebDriver means all tests use the same browser instance.
Step 2: Identify concurrency issues
Sharing one WebDriver causes conflicts like commands overlapping, leading to test failures.
Final Answer:
Tests will fail due to WebDriver conflicts from shared instance. -> Option A
Believing TestNG creates separate WebDriver automatically
5. You want to run your Selenium tests in parallel in CI using TestNG. Your suite has 5 test classes, each with 3 test methods. You want to run all methods in parallel but limit total threads to 6. Which TestNG XML configuration is correct?
hard
A.
B.
C.
D.
Solution
Step 1: Identify parallel="methods" for running all test methods in parallel
To run all methods in parallel, use parallel="methods" in the suite tag.
Step 2: Set thread-count="6" to limit total threads
thread-count="6" limits the number of simultaneous threads to 6, matching the requirement.
Step 3: Confirm classes are inside a single <test> tag
All classes are grouped under one <test> tag, so methods from all classes run in parallel within the thread limit.
Final Answer:
<suite parallel="methods" thread-count="6"> -> Option D
Quick Check:
parallel="methods" + thread-count="6" + single <test> [OK]
Hint: Use parallel="methods" with thread-count to control concurrency [OK]
Common Mistakes:
Using parallel="classes" runs classes in parallel, not methods
Using thread-count too high ignores limit
Splitting classes into multiple tests changes parallel behavior
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.