Bird
Raised Fist0
Selenium Javatesting~20 mins

Extent report customization in Selenium Java - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Extent Report Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
Output of ExtentReports Configuration Code
What will be the title of the report generated by the following ExtentReports configuration code snippet?
Selenium Java
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent.html");
htmlReporter.config().setDocumentTitle("My Test Report");
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
extent.createTest("Sample Test").pass("Test passed successfully");
extent.flush();
AMy Test Report
BSample Test
Cextent.html
DTest passed successfully
Attempts:
2 left
💡 Hint
Look at the method that sets the document title in the htmlReporter configuration.
❓ assertion
intermediate
2:00remaining
Correct Assertion for Extent Test Status
Which assertion correctly verifies that an ExtentTest has passed after execution?
Selenium Java
ExtentTest test = extent.createTest("Login Test");
test.pass("Login successful");
AassertEquals(test.getStatus(), Status.PASS);
BassertTrue(test.getStatus() == Status.FAIL);
CassertNull(test.getStatus());
DassertFalse(test.getStatus() == Status.PASS);
Attempts:
2 left
💡 Hint
Check the status set by the pass() method and compare it correctly.
❓ locator
advanced
2:00remaining
Best Locator for Customizing Extent Report Theme
In ExtentHtmlReporter configuration, which method correctly sets the theme to DARK mode?
AhtmlReporter.setConfig("theme", "dark");
BhtmlReporter.setTheme("dark");
ChtmlReporter.config().theme = "dark";
DhtmlReporter.config().setTheme(Theme.DARK);
Attempts:
2 left
💡 Hint
Check the official ExtentHtmlReporter API for setting themes.
🔧 Debug
advanced
2:00remaining
Identify the Error in Extent Report Initialization
What error will occur when running this ExtentReports initialization code?
Selenium Java
ExtentReports extent = new ExtentReports();
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter();
extent.attachReporter(htmlReporter);
AIllegalArgumentException due to missing file path
BNullPointerException at attachReporter
CCompilation error: No suitable constructor found for ExtentHtmlReporter()
DNo error, code runs successfully
Attempts:
2 left
💡 Hint
Check the constructors available for ExtentHtmlReporter.
❓ framework
expert
3:00remaining
Customizing Extent Report with System Info and Multiple Tests
Given the following code snippet, what will be the value of the system info key "OS" in the generated report?
Selenium Java
ExtentReports extent = new ExtentReports();
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("report.html");
extent.attachReporter(htmlReporter);
extent.setSystemInfo("OS", "Windows 10");
ExtentTest test1 = extent.createTest("Test 1");
test1.pass("Step 1 passed");
ExtentTest test2 = extent.createTest("Test 2");
test2.fail("Step 2 failed");
extent.flush();
Anull
BWindows 10
CStep 1 passed
DTest 1
Attempts:
2 left
💡 Hint
System info is set once on the ExtentReports object and is global for the report.

Practice

(1/5)
1. What is the main purpose of customizing an Extent report in Selenium Java?
easy
A. To make test results clearer and easier to understand
B. To increase the speed of test execution
C. To reduce the size of the test scripts
D. To automatically fix test failures

Solution

  1. Step 1: Understand Extent report role

    Extent reports show test results in a readable format.
  2. Step 2: Identify customization benefits

    Customization helps make these results clearer and more useful.
  3. Final Answer:

    To make test results clearer and easier to understand -> Option A
  4. Quick Check:

    Customization = clearer test results [OK]
Hint: Think: Why improve report look? To understand results better [OK]
Common Mistakes:
  • Confusing report customization with test speed
  • Thinking customization changes test logic
  • Assuming customization fixes test errors
2. Which code snippet correctly sets the theme of an Extent report to DARK in Selenium Java?
easy
A. extentHtmlReporter.config().setTheme(Theme.DARK);
B. extentHtmlReporter.setTheme("dark");
C. extentHtmlReporter.config().theme = "dark";
D. extentHtmlReporter.setConfigTheme(Theme.DARK);

Solution

  1. Step 1: Recall ExtentReports theme setting syntax

    Use config() method and setTheme with Theme enum.
  2. Step 2: Match correct method and enum usage

    Only extentHtmlReporter.config().setTheme(Theme.DARK); uses config().setTheme(Theme.DARK) correctly.
  3. Final Answer:

    extentHtmlReporter.config().setTheme(Theme.DARK); -> Option A
  4. Quick Check:

    Use config().setTheme(Theme.DARK) [OK]
Hint: Remember: config() then setTheme with Theme enum [OK]
Common Mistakes:
  • Using setTheme directly without config()
  • Passing theme as string instead of Theme enum
  • Using incorrect method names
3. Given the following code snippet, what will be the title of the generated Extent report?
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("testReport.html");
htmlReporter.config().setDocumentTitle("My Test Report");
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter);
medium
A. Extent Report
B. testReport.html
C. My Test Report
D. Default Title

Solution

  1. Step 1: Identify method setting report title

    config().setDocumentTitle("My Test Report") sets the HTML page title.
  2. Step 2: Understand effect on report

    The report's browser tab will show "My Test Report" as title.
  3. Final Answer:

    My Test Report -> Option C
  4. Quick Check:

    setDocumentTitle sets report title [OK]
Hint: Look for setDocumentTitle method for report title [OK]
Common Mistakes:
  • Confusing file name with report title
  • Assuming default title is used
  • Ignoring config() method effects
4. Identify the error in the following code that prevents the Extent report from saving properly:
ExtentHtmlReporter reporter = new ExtentHtmlReporter("report.html");
ExtentReports extent = new ExtentReports();
extent.attachReporter(reporter);
// Missing flush call
medium
A. ExtentHtmlReporter should be initialized after ExtentReports
B. Incorrect file name extension, should be .txt
C. attachReporter method is deprecated and should not be used
D. Missing call to extent.flush() to save the report

Solution

  1. Step 1: Check report saving process

    Extent report requires extent.flush() to write data to file.
  2. Step 2: Identify missing flush call

    The code does not call extent.flush(), so report is not saved.
  3. Final Answer:

    Missing call to extent.flush() to save the report -> Option D
  4. Quick Check:

    Always call extent.flush() to save report [OK]
Hint: Remember to call extent.flush() after tests [OK]
Common Mistakes:
  • Forgetting to call flush()
  • Changing file extension incorrectly
  • Misunderstanding attachReporter usage
5. You want to add system information like OS and Java version to your Extent report. Which code snippet correctly adds this info before flushing the report?
ExtentReports extent = new ExtentReports();
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("sysInfoReport.html");
extent.attachReporter(htmlReporter);
// Add system info here
extent.flush();
hard
A. htmlReporter.setSystemInfo("OS", System.getProperty("os.name")); htmlReporter.setSystemInfo("Java Version", System.getProperty("java.version"));
B. extent.addSystemInfo("OS", System.getProperty("os.name")); extent.addSystemInfo("Java Version", System.getProperty("java.version"));
C. extent.setSystemInfo("OS", System.getProperty("os.name")); extent.setSystemInfo("Java Version", System.getProperty("java.version"));
D. htmlReporter.addSystemInfo("OS", System.getProperty("os.name")); htmlReporter.addSystemInfo("Java Version", System.getProperty("java.version"));

Solution

  1. Step 1: Identify correct method to add system info

    ExtentReports class has addSystemInfo method to add info.
  2. Step 2: Confirm usage on ExtentReports instance

    System info is added on extent, not on htmlReporter.
  3. Final Answer:

    extent.addSystemInfo("OS", System.getProperty("os.name")); extent.addSystemInfo("Java Version", System.getProperty("java.version")); -> Option B
  4. Quick Check:

    Use extent.addSystemInfo() before flush [OK]
Hint: Add system info on extent, not htmlReporter [OK]
Common Mistakes:
  • Calling setSystemInfo on htmlReporter instead of extent
  • Using setSystemInfo which does not exist
  • Adding system info after flush()
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard