Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create an ExtentReports object.
Selenium Java
ExtentReports extent = new [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ExtentTest instead of ExtentReports.
Confusing ExtentSparkReporter with ExtentReports.
✗ Incorrect
The ExtentReports class is used to create the main report object.
2fill in blank
mediumComplete the code to initialize ExtentSparkReporter with a file path.
Selenium Java
ExtentSparkReporter spark = new ExtentSparkReporter([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a File object instead of a String path.
Using Paths.get which returns a Path, not a String.
✗ Incorrect
The ExtentSparkReporter constructor takes a String path for the report file.
3fill in blank
hardFix the error in attaching the reporter to ExtentReports.
Selenium Java
extent.[1](spark); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using addReporter which does not exist.
Using addReport which is incorrect.
✗ Incorrect
The correct method to attach a reporter is attachReporter.
4fill in blank
hardFill both blanks to create a test and log a pass status.
Selenium Java
ExtentTest test = extent.[1]("Sample Test"); test.[2](Status.PASS, "Test passed successfully");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using startTest instead of createTest.
Using pass method which does not exist.
✗ Incorrect
Use createTest to create a test and log to record the status.
5fill in blank
hardFill all three blanks to flush the report after tests.
Selenium Java
extent.[1](); // After tests extent.[2](); System.out.println("Report saved at: [3]");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not calling flush before close.
Printing wrong file path.
✗ Incorrect
Flush writes the report, close releases resources, and the file path is "report.html".