Challenge - 5 Problems
TestNG Suite Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
TestNG Suite Execution Order
Given the following
testng.xml configuration, what is the order of test method execution?Selenium Java
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"> <suite name="Suite1"> <test name="Test1"> <classes> <class name="tests.SampleTest" /> </classes> </test> <test name="Test2" preserve-order="false"> <classes> <class name="tests.AnotherTest" /> </classes> </test> </suite>
Attempts:
2 left
💡 Hint
Look at the
preserve-order attribute and default behavior of TestNG suites.✗ Incorrect
By default, TestNG runs tests in the order they appear in the suite file. The first test 'Test1' runs all methods in SampleTest in defined order. The second test 'Test2' has preserve-order set to false, so methods in AnotherTest can run in any order, but only after Test1 completes.
❓ assertion
intermediate2:00remaining
Assertion on TestNG Suite Parallel Execution
Which assertion correctly verifies that tests defined in
testng.xml run in parallel mode?Selenium Java
<suite name="ParallelSuite" parallel="tests" thread-count="3"> <test name="TestA"> <classes> <class name="tests.TestA" /> </classes> </test> <test name="TestB"> <classes> <class name="tests.TestB" /> </classes> </test> </suite>
Attempts:
2 left
💡 Hint
Check the attribute that controls parallel execution in TestNG suite.
✗ Incorrect
The
parallel attribute in the suite defines the parallel mode. Using suite.getParallel() returns the parallel mode string, which should be "tests" here. Other assertions either check wrong properties or wrong values.🔧 Debug
advanced2:00remaining
Debugging Missing Test Execution in testng.xml
A tester notices that one test class is not running when executing the suite defined below. What is the most likely cause?
Selenium Java
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"> <suite name="SuiteDebug"> <test name="TestGroup"> <groups> <run> <include name="smoke" /> </run> </groups> <classes> <class name="tests.LoginTest" /> <class name="tests.PaymentTest" /> </classes> </test> </suite>
Attempts:
2 left
💡 Hint
Check how TestNG runs tests filtered by groups.
✗ Incorrect
When groups are included in the suite, only test methods annotated with those groups run. If PaymentTest methods lack the @Test(groups = "smoke") annotation, they will be skipped. The tag is correctly placed inside . Parallel attribute is unrelated to this issue.
❓ framework
advanced2:00remaining
Configuring TestNG Suite for Multiple Browsers
Which
testng.xml snippet correctly configures two tests to run in parallel on Chrome and Firefox browsers using parameters?Attempts:
2 left
💡 Hint
Parallel tests with different parameters require separate tags.
✗ Incorrect
Option B defines two separate tags each with a different browser parameter and runs them in parallel. Option B passes both browsers as a single parameter value, which is not interpreted as two runs. Option B runs classes in parallel but does not pass parameters. Option B defines duplicate parameters in one test, which is invalid.
🧠 Conceptual
expert2:00remaining
Impact of preserve-order and parallel Attributes in testng.xml
Consider a TestNG suite with
parallel="tests" and preserve-order="false" on a <test> tag. Which statement best describes the execution behavior?Attempts:
2 left
💡 Hint
Understand how preserve-order affects method execution inside tests when parallel is enabled.
✗ Incorrect
Setting parallel="tests" runs tests concurrently. preserve-order="false" on a test means methods inside that test do not preserve their declaration order and can run in any order. So tests run in parallel, and methods inside each test run unordered.