Challenge - 5 Problems
Extent Reports Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Extent Reports setup code?
Consider the following Java code snippet that initializes Extent Reports in a Selenium test. What will be the output in the generated report after running this code?
Selenium Java
ExtentReports extent = new ExtentReports(); ExtentTest test = extent.createTest("Login Test"); test.pass("Login successful"); extent.flush();
Attempts:
2 left
💡 Hint
ExtentReports requires a reporter (like ExtentHtmlReporter) to be attached via attachReporter() before flush() generates a file.
✗ Incorrect
No report is generated because the ExtentReports object was not configured with a reporter (e.g., ExtentHtmlReporter attached via attachReporter()). Without it, extent.flush() does not create any report file.
❓ assertion
intermediate2:00remaining
Which assertion correctly verifies the test status in Extent Reports?
You want to verify in your Selenium test that the ExtentTest status is marked as FAIL after a failed login attempt. Which assertion is correct?
Selenium Java
ExtentTest test = extent.createTest("Login Test"); test.fail("Login failed due to invalid credentials");
Attempts:
2 left
💡 Hint
Check the ExtentTest API for how status is represented.
✗ Incorrect
ExtentTest.getStatus() returns an enum Status. Comparing it with Status.FAIL using assertEquals is the correct way.
🔧 Debug
advanced2:00remaining
Why does this Extent Reports setup not generate any report file?
Review the following Java code snippet. Why does it fail to generate the Extent Report file?
Selenium Java
ExtentReports extent = new ExtentReports(); ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("report.html"); ExtentTest test = extent.createTest("Sample Test"); test.pass("Test passed"); // Missing extent.attachReporter(htmlReporter); extent.flush();
Attempts:
2 left
💡 Hint
Check if the reporter is attached to the ExtentReports object.
✗ Incorrect
Without attaching the reporter using extent.attachReporter(htmlReporter), ExtentReports does not know where to write the report, so no file is generated.
❓ framework
advanced2:00remaining
Which Extent Reports setup is best for parallel test execution in Selenium?
You want to run Selenium tests in parallel and generate a single Extent Report. Which setup ensures thread-safe logging?
Attempts:
2 left
💡 Hint
Think about how to keep test logs separate per thread safely.
✗ Incorrect
Using ThreadLocal allows each thread to have its own test instance, avoiding conflicts. A single ExtentReports instance is shared and flushed safely after all tests.
🧠 Conceptual
expert2:00remaining
What is the primary purpose of calling extent.flush() in Extent Reports?
In the Extent Reports lifecycle, what does the method extent.flush() do?
Attempts:
2 left
💡 Hint
Think about when the report file gets updated with test results.
✗ Incorrect
Calling extent.flush() writes all accumulated test logs to the report file. Without it, the report file remains empty or incomplete.