Bird
0
0

Consider the following testng.xml configuration:

medium📝 Predict Output Q4 of 15
Selenium Java - TestNG Integration
Consider the following testng.xml configuration:
<suite name="RegressionSuite">
  <test name="LoginTests">
    <classes>
      <class name="tests.LoginTest" />
    </classes>
  </test>
  <test name="CheckoutTests">
    <classes>
      <class name="tests.CheckoutTest" />
    </classes>
  </test>
</suite>
Which test classes will be executed when this suite runs?
ABoth <code>LoginTest</code> and <code>CheckoutTest</code> classes will run
BOnly <code>LoginTest</code> class will run
COnly <code>CheckoutTest</code> class will run
DNo tests will run due to missing <code>methods</code> tag
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the <suite> tag

    The suite named "RegressionSuite" contains two <test> tags.
  2. Step 2: Check each <test> tag

    Each <test> tag includes a <classes> section with one class: "tests.LoginTest" and "tests.CheckoutTest" respectively.
  3. Step 3: Determine which tests run

    Since both tests are defined properly with classes, both LoginTest and CheckoutTest will be executed.
  4. Final Answer:

    Both LoginTest and CheckoutTest classes will run -> Option A
  5. Quick Check:

    All classes inside <test> tags run unless misconfigured [OK]
Quick Trick: All classes inside tests run unless misconfigured [OK]
Common Mistakes:
MISTAKES
  • Assuming only the first test runs
  • Thinking methods tag is mandatory for classes to run
  • Confusing test and suite tags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes