Bird
0
0

Given the following testng.xml snippet, what tests will run?

medium📝 Predict Output Q13 of 15
Selenium Java - TestNG Integration
Given the following testng.xml snippet, what tests will run?
<suite name="Suite1" parallel="tests" thread-count="2">
  <test name="TestA">
    <classes>
      <class name="tests.LoginTest"/>
    </classes>
  </test>
  <test name="TestB">
    <classes>
      <class name="tests.PaymentTest"/>
    </classes>
  </test>
</suite>
ANo tests run due to missing <code>methods</code> tag
BBoth LoginTest and PaymentTest run in parallel as separate tests
CTests run sequentially, LoginTest then PaymentTest
DOnly LoginTest runs because it is first
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the parallel attribute in <suite>

    The attribute parallel="tests" means each <test> runs in parallel threads.
  2. Step 2: Identify the tests defined

    There are two tests: TestA with LoginTest class and TestB with PaymentTest class.
  3. Final Answer:

    Both LoginTest and PaymentTest run in parallel as separate tests -> Option B
  4. Quick Check:

    parallel="tests" runs tests simultaneously = Both LoginTest and PaymentTest run in parallel as separate tests [OK]
Quick Trick: parallel="tests" runs each in parallel [OK]
Common Mistakes:
MISTAKES
  • Assuming tests run sequentially despite parallel attribute
  • Thinking tag is mandatory to run tests
  • Confusing parallel="tests" with parallel="classes"

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes