1.
ExtentReports is an logger-style reporting
library for automated tests.
2.
A logger is simply an object to log messages or
events for a specific system or application.
3.
ExtentReports uses the logging style to add
information about test sessions, such as creation of tests, adding screenshots,
assigning tags, and adding events or series of steps to sequentially indicate
the flow of test steps.
Extent Reports in Selenium contain two frequently used classes:
· ExtentReports class
· ExtentTest class
Syntax
ExtentReports reports = new ExtentReports("Path
of directory to store the resultant HTML file", true/false);
ExtentTest test =
reports.startTest("TestName");
Both classes can be used with the following built-in methods:
· startTest: Executes preconditions of a test case
· endTest: Executes postconditions of a test case
· Log: Logs the status of each test step onto the HTML report being generated
· Flush: Erases any previous data on a relevant report and creates a whole new report
A Test Status can be indicated by the following values:
· PASS
· FAIL
· SKIP
· INFO
Syntax:
test.log(LogStatus.PASS,”Test
Passed”);
Maven Dependency:
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
Benefits of Extent Reports:
- They can be integrated with TestNG and Junit
- screenshots can be captured and displayed for
each step in a test
- They show the time needed for test execution
- They can be customized to graphically represent
each step in a test.
Comments
Post a Comment