Bird
0
0

Which of the following is the correct way to define a test suite in testng.xml?

easy📝 Syntax Q12 of 15
Selenium Java - TestNG Integration
Which of the following is the correct way to define a test suite in testng.xml?
A<suite name="MySuite"><test name="Test1"><classes><class name="TestClass"/></classes></test></suite>
B<test name="MySuite"><suite name="Test1"><class name="TestClass"/></suite></test>
C<classes name="MySuite"><suite name="Test1"><test name="TestClass"/></suite></classes>
D<class name="MySuite"><test name="Test1"><suite name="TestClass"/></test></class>
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct XML structure for TestNG suites

    The root element is <suite>, inside it we define <test>, then <classes> and <class>.
  2. Step 2: Match the options with correct structure

    correctly follows this order and syntax.
  3. Final Answer:

    <suite name="MySuite"><test name="Test1"><classes><class name="TestClass"/></classes></test></suite> -> Option A
  4. Quick Check:

    Suite > Test > Classes > Class = [OK]
Quick Trick: Remember XML order: suite > test > classes > class [OK]
Common Mistakes:
  • Swapping and tags
  • Placing directly under
  • Using wrong tag names or attributes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes