Bird
0
0

How can you configure testng.xml to run tests in parallel at the class level with 3 threads?

hard📝 framework Q9 of 15
Selenium Java - TestNG Integration
How can you configure testng.xml to run tests in parallel at the class level with 3 threads?
A<suite name="Suite1" parallel="classes" thread-count="3"> ... </suite>
B<suite name="Suite1" parallel="tests" thread-count="3"> ... </suite>
C<test name="Test1" parallel="classes" thread-count="3"> ... </test>
D<test name="Test1" parallel="methods" thread-count="3"> ... </test>
Step-by-Step Solution
Solution:
  1. Step 1: Understand parallel attribute scope

    Setting parallel="classes" in the <suite> tag runs classes in parallel.
  2. Step 2: Set thread-count at suite level

    Thread count controls how many threads run simultaneously; setting it to 3 allows 3 parallel classes.
  3. Final Answer:

    <suite name="Suite1" parallel="classes" thread-count="3"> ... </suite> -> Option A
  4. Quick Check:

    parallel="classes" + thread-count in suite runs classes parallel [OK]
Quick Trick: Set parallel="classes" and thread-count in [OK]
Common Mistakes:
  • Setting parallel in instead of
  • Using parallel="tests" for class-level parallelism
  • Confusing thread-count placement

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes