TestNG default reports help you see which tests passed or failed without extra setup. They give quick feedback on your test results.
TestNG default reports in Selenium Java
TestNG automatically generates reports after test execution. Reports are saved in the 'test-output' folder by default. You do not need to write code to create these reports.
The main report files are index.html and emailable-report.html.
Reports include test status, execution time, and error details for failures.
@Test
public void testExample() {
Assert.assertTrue(true);
}@Test
public void testFail() {
Assert.assertTrue(false);
}This test class has two tests: one passes and one fails. After running with TestNG, the default report will show one pass and one fail.
import org.testng.Assert; import org.testng.annotations.Test; public class SampleTest { @Test public void testPass() { Assert.assertTrue(true); } @Test public void testFail() { Assert.assertTrue(false, "This test is designed to fail."); } }
TestNG creates the test-output folder automatically after tests run.
You can open test-output/index.html in a browser to see a detailed report.
Reports update every time you run tests, showing the latest results.
TestNG default reports show test results automatically after running tests.
They help quickly identify passed and failed tests with error details.
No extra code is needed to generate these reports; just run your tests.
Practice
Solution
Step 1: Understand what TestNG default reports do
TestNG default reports automatically display the results of tests after execution without extra coding.Step 2: Compare options with this function
Only To automatically show test results after running tests matches this description; others describe unrelated tasks.Final Answer:
To automatically show test results after running tests -> Option BQuick Check:
TestNG default reports = automatic test result display [OK]
- Thinking reports require extra code
- Confusing reports with code compilation
- Assuming reports manage databases
Solution
Step 1: Identify the default report file location
TestNG generates reports inside the 'test-output' folder, with 'index.html' as the main report file.Step 2: Check other options for correctness
Other files are unrelated: source code, build config, or logs.Final Answer:
test-output/index.html -> Option AQuick Check:
Default report file = test-output/index.html [OK]
- Confusing source code files with report files
- Expecting reports in pom.xml or logs
- Not checking the test-output directory
Solution
Step 1: Analyze the test results given
There are two tests that passed and one test that failed.Step 2: Match the counts to the report format
The report shows counts as Passed: 2, Failed: 1, Skipped: 0.Final Answer:
Passed: 2, Failed: 1, Skipped: 0 -> Option AQuick Check:
Test counts in report = Passed 2, Failed 1 [OK]
- Mixing passed and failed counts
- Assuming skipped tests when none exist
- Misreading the test result numbers
Solution
Step 1: Understand why no tests run
If test methods lack the @Test annotation, TestNG will not recognize or run them.Step 2: Evaluate other options
Corrupted jar or Java version issues usually cause errors, not silent no tests. Deleting report folder does not affect test execution.Final Answer:
Test methods are missing the @Test annotation -> Option DQuick Check:
No @Test annotation = no tests run [OK]
- Assuming report folder deletion stops tests
- Blaming Java version without error messages
- Ignoring missing @Test annotations
Solution
Step 1: Understand default report customization
TestNG default reports do not support screenshots by default; customization requires listeners like ITestListener.Step 2: Evaluate options for adding screenshots
Adding listeners to capture screenshots on failure and embed them is the correct approach. Manual editing or renaming folders won't add screenshots. Disabling reports removes them entirely.Final Answer:
By adding listeners and embedding screenshots in the report via ITestListener -> Option CQuick Check:
Use ITestListener to add screenshots [OK]
- Trying to edit report files manually
- Renaming folders expecting new features
- Disabling reports instead of customizing
Ready to prove it?
Pass the test and this pattern moves unknown
