Recall & Review
beginner
What is the purpose of the <suite> tag in a testng.xml file?
The <suite> tag defines the entire test suite. It groups multiple <test> tags and controls the overall execution of tests in TestNG.
Click to reveal answer
beginner
How do you specify which test classes to run inside a <test> tag in testng.xml?
Inside the <test> tag, use the <classes> tag, and inside it, add one or more <class name="fully.qualified.ClassName"/> tags.Click to reveal answer
intermediate
What attribute in the <suite> tag controls the parallel execution of tests?
The 'parallel' attribute controls parallel execution. It can be set to 'tests', 'classes', 'methods', or 'instances' to run those elements in parallel.
Click to reveal answer
intermediate
How can you set a timeout for all tests in a test suite using testng.xml?
You can set the 'time-out' attribute inside the <test> tag or use listeners in code. The 'time-out' attribute specifies the max time in milliseconds a test can run.
Click to reveal answer
beginner
Explain the role of the <parameter> tag in testng.xml.
The <parameter> tag allows you to pass values to test methods. You define a name and value in testng.xml, and the test method can receive it using @Parameters annotation.
Click to reveal answer
Which tag in testng.xml defines a group of tests to run together?
✗ Incorrect
The tag groups multiple tags and defines the whole test suite.
How do you specify a test class to run in testng.xml?
✗ Incorrect
Inside , you specify to run that class.
What does setting parallel="methods" in <suite> do?
✗ Incorrect
parallel="methods" runs all test methods in parallel threads.
Where do you define parameters to pass to test methods in testng.xml?
✗ Incorrect
Parameters are defined inside or tags using .
What is the default execution order of tests in testng.xml if parallel is not set?
✗ Incorrect
By default, tests run sequentially if parallel attribute is not set.
Describe the structure of a basic testng.xml file and explain the role of each main tag.
Think about how you organize tests in groups and classes.
You got /4 concepts.
How can you configure parallel execution and parameter passing in testng.xml? Give examples.
Consider how to speed up tests and customize test inputs.
You got /4 concepts.