Complete the code to initialize the ExtentReports object for report publishing.
ExtentReports extent = new ExtentReports();
extent.attachReporter(new ExtentHtmlReporter([1]));The ExtentHtmlReporter requires a string path with quotes to specify the report file location.
Complete the code to flush the ExtentReports so the report is saved after tests.
extent.[1]();close() which may not save the report properly.save() which does not exist.The flush() method writes all the test information to the report file.
Fix the error in the code to correctly add a test log entry with status PASS.
test.[1](Status.PASS, "Test passed successfully");
addLog or writeLog.record which is not a method here.The correct method to log test status in ExtentTest is log().
Fill both blanks to create a Jenkins pipeline step that archives the test report folder and publishes the HTML report.
archiveArtifacts '[1]' publishHTML (target: [allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: '[2]', reportFiles: 'report.html', reportName: 'Test Report'])
The archiveArtifacts step needs the folder with wildcard test-output/** to archive all files, and publishHTML uses the folder test-output as the report directory.
Fill all three blanks to configure a Maven Surefire plugin to generate test reports in XML format for CI integration.
<configuration> <reportsDirectory>[1]</reportsDirectory> <testFailureIgnore>[2]</testFailureIgnore> <reportFormat>[3]</reportFormat> </configuration>
testFailureIgnore to true which ignores failures.The reports directory for Surefire is target/surefire-reports. To fail the build on test failures, testFailureIgnore should be false. The report format for CI is usually xml.