0
0
Selenium Javatesting~5 mins

Test suites (testng.xml) in Selenium Java - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A<test>
B<suite>
C<class>
D<methods>
How do you specify a test class to run in testng.xml?
A<class name="fully.qualified.ClassName"/>
B<class>fully.qualified.ClassName</class>
C<testcase>
D<class name="ClassName"/>
What does setting parallel="methods" in <suite> do?
ARuns all test classes sequentially
BRuns all tests in parallel
CRuns all test methods in parallel
DRuns all test suites in parallel
Where do you define parameters to pass to test methods in testng.xml?
AInside <suite> or <test> using <parameter>
BInside <class> tag
CInside <methods> tag
DInside <test> using <parameter-set>
What is the default execution order of tests in testng.xml if parallel is not set?
AParallel execution of tests
BRandom execution order
CDepends on JVM
DSequential execution of tests
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.