Bird
0
0

You have this testng.xml file but tests are not running:

medium📝 Debug Q14 of 15
Selenium Java - TestNG Integration
You have this testng.xml file but tests are not running:
<suite name="Suite1">
  <test name="Test1">
    <class name="TestClass">
    </class>
  </test>
</suite>

What is the likely problem?
AThe <code><suite></code> tag must include <code>thread-count</code>
BThe <code><test></code> tag is missing the <code>parallel</code> attribute
CThe class name must include the package name
DThe <code><class></code> tag should be self-closing or empty, not with separate open and close tags
Step-by-Step Solution
Solution:
  1. Step 1: Check the <class> tag syntax

    In TestNG XML, <class> should be self-closing like <class name="TestClass"/> or empty without content.
  2. Step 2: Identify the error in the given XML

    The given XML uses separate open and close tags for <class> which is invalid and causes tests not to run.
  3. Final Answer:

    The <class> tag should be self-closing or empty, not with separate open and close tags -> Option D
  4. Quick Check:

    Use self-closing <class> tag = The <class> tag should be self-closing or empty, not with separate open and close tags [OK]
Quick Trick: Use self-closing tag in testng.xml [OK]
Common Mistakes:
  • Adding parallel attribute thinking it fixes syntax
  • Forgetting package name but that doesn't stop tests
  • Assuming thread-count is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes