Here are multiple-choice questions (MCQs) on ExtentReports, which is a popular reporting library used in automation testing for generating detailed, interactive, and visually appealing test reports.
1. What is ExtentReports used for in automation testing?
A) Managing WebDriver binaries
B) Generating detailed, interactive test reports
C) Writing test cases
D) Executing test scripts
Answer: B) Generating detailed, interactive test reports
2. Which of the following is the correct Maven dependency to add ExtentReports to a project?
A)
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.9</version>
</dependency>
B)
<dependency>
<groupId>org.testng</groupId>
<artifactId>extentreports</artifactId>
<version>4.1.0</version>
</dependency>
C)
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>4.1.0</version>
</dependency>
D)
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.9</version>
</dependency>
Answer: A)
4. What class in ExtentReports is used to create individual test cases in the report?
A) ExtentLogger
B) ExtentTest
C) TestCase
D) ReportTest
Answer: B) ExtentTest
5. How do you log a pass status for a test step in ExtentReports?
A) test.pass("Step passed successfully");
B) test.log(Status.PASS, "Step passed successfully");
C) test.log(Status.PASS, new MarkupHelper().createLabel("Step passed successfully"));
D) test.info(Status.PASS, "Step passed successfully");
Answer: B) test.log(Status.PASS, "Step passed successfully");
6. Which method in ExtentReports is used to generate the final report?
A) extent.flush();
B) extent.close();
C) extent.generate();
D) extent.save();
Answer: A) extent.flush();
8. How do you add a screenshot to a test step in ExtentReports?
A) test.addScreenCapture("screenshot.png");
B) test.attachScreenshot("screenshot.png");
C) test.addScreenCaptureFromPath("screenshot.png");
D) test.screenshot("screenshot.png");
Answer: C) test.addScreenCaptureFromPath("screenshot.png");
10. How do you set the document title of an Extent report?
A) extent.setTitle("Automation Test Report");
B) htmlReporter.config().setDocumentTitle("Automation Test Report");
C) extent.config().setTitle("Automation Test Report");
D) ExtentReports.setTitle("Automation Test Report");
Answer: B) htmlReporter.config().setDocumentTitle("Automation Test Report");
11. What does the method test.fail("Step failed"); do in ExtentReports?
A) Marks the test case as failed
B) Logs the failure of a specific step in the test
C) Stops the test execution
D) Clears the test results
Answer: B) Logs the failure of a specific step in the test
13. In ExtentReports, what is the significance of the extent.flush() method?
A) It ends the current test case execution
B) It clears the test log
C) It writes the test information to the report and clears the report data in memory
D) It initializes the ExtentReports object
Answer: C) It writes the test information to the report and clears the report data in memory
14. What configuration method in ExtentHtmlReporter sets the theme of the report?
A) htmlReporter.setTheme(Theme.DARK);
B) htmlReporter.setReportTheme(Theme.STANDARD);
C) htmlReporter.config().setTheme(Theme.STANDARD);
D) htmlReporter.setStyle(Style.DARK);
Answer: C) htmlReporter.config().setTheme(Theme.STANDARD);
15. How can you create a hierarchical view of tests in ExtentReports?
A) By using test.createNode() method
B) By setting extent.setHierarchy(true);
C) By adding tests under a master test
D) By using extent.startGroup()
Answer: A) By using test.createNode() method
16. What does the Status.SKIP indicate in ExtentReports?
A) The test was not executed due to some error
B) The test passed but had minor issues
C) The test was skipped due to a dependency on another test
D) The test failed but was ignored
Answer: C) The test was skipped due to a dependency on another test
17. How do you attach a log message with a warning status to a test in ExtentReports?
A) test.warn("This is a warning message");
B) test.log(Status.WARNING, "This is a warning message");
C) test.log(Status.WARN, "This is a warning message");
D) test.log("This is a warning message", Status.WARN);
Answer: C) test.log(Status.WARN, "This is a warning message");
18. Which of the following methods is used to add system information to ExtentReports?
A) extent.addSystemInfo("OS", "Windows 10");
B) extent.setSystemInfo("OS", "Windows 10");
C) extent.config().setSystemInfo("OS", "Windows 10");
D) extent.systemInfo("OS", "Windows 10");
Answer: B) extent.setSystemInfo("OS", "Windows 10");
19. What does the setAppendExisting method of ExtentHtmlReporter do?
A) Appends new test results to the existing report
B) Appends screenshots to the test report
C) Overwrites the existing report file
D) Merges multiple reports into one
Answer: A) Appends new test results to the existing report
20. Which method in ExtentReports is used to start a test suite?
A) extent.createSuite("Suite Name");
B) extent.createTest("Suite Name");
C) extent.startSuite("Suite Name");
D) extent.initSuite("Suite Name");
Answer: B) extent.createTest("Suite Name");
These MCQs cover various aspects of ExtentReports, including its setup, usage, methods, and configuration options for generating detailed test reports in automation testing.
No comments:
Post a Comment