Challenge - 5 Problems
TestNG Report Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
TestNG Default Report: Passed Tests Count
Given the following TestNG test class, what will be the count of passed tests shown in the default TestNG report after execution?
Selenium Java
import org.testng.annotations.Test; public class SampleTest { @Test public void testA() { assert true; } @Test public void testB() { assert true; } @Test public void testC() { assert false; } }
Attempts:
2 left
💡 Hint
Remember that tests with failed assertions are not counted as passed.
✗ Incorrect
Tests testA and testB pass because their assertions are true. testC fails due to assertion false. So, the passed tests count is 2.
❓ assertion
intermediate2:00remaining
Assertion in TestNG Default Report for Skipped Tests
If a test method is annotated with @Test and depends on another test that fails, what will the default TestNG report show for the dependent test?
Selenium Java
import org.testng.annotations.Test; public class DependencyTest { @Test public void test1() { assert false; } @Test(dependsOnMethods = {"test1"}) public void test2() { assert true; } }
Attempts:
2 left
💡 Hint
Think about what happens when a dependency test fails in TestNG.
✗ Incorrect
Since test1 fails, test2 which depends on test1 is skipped. The default TestNG report marks such tests as skipped.
🔧 Debug
advanced2:00remaining
Debugging Missing Test Results in TestNG Default Report
A tester notices that some test methods are not appearing in the TestNG default report after execution. Which of the following is the most likely cause?
Attempts:
2 left
💡 Hint
TestNG only recognizes methods with a specific annotation as tests.
✗ Incorrect
Only methods annotated with @Test are included in the report. Missing this annotation means TestNG ignores those methods.
🧠 Conceptual
advanced2:00remaining
Understanding TestNG Default Report Structure
Which section is NOT part of the default TestNG HTML report generated after test execution?
Attempts:
2 left
💡 Hint
Think about what TestNG reports by default without extra tools.
✗ Incorrect
TestNG default reports do not include code coverage data; that requires additional tools like JaCoCo.
❓ framework
expert3:00remaining
Customizing TestNG Default Reports
Which of the following is the correct way to add custom logging information to the TestNG default report?
Attempts:
2 left
💡 Hint
TestNG allows listeners to hook into test events for custom behavior.
✗ Incorrect
Implementing ITestListener and overriding methods like onTestSuccess allows adding custom logs to reports.