In this article, we see one of the most popular and widely used Selenium Reporting Tools (Extent Reports). Selenium Results can be seen using different Selenium Reporting tools. Some of the Selenium WebDriver Reporting tools are as follows.
- Selenium TestNG Report Generation
- Selenium JUnit Report Generation
- Selenium Extent Reports
What are the Extent Reports?
ExtentReports is an open-source reporting library used in selenium test automation. Extent reports become the first choice of Selenium Automation Testers, even though Selenium comes with inbuilt reports using frameworks like JUnit and TestNG. With extent reports, you can offer a more extensive and insightful perspective on the execution of your automation scripts. So let’s see why Automation testers prefer Extent reports to others.
Advantages of Extent Reports:
Some of the advantages of Extent Reports are as follows
- Extent reports are more customizable than others
- Extent API can produce more interactive reports, a dashboard view, graphical view, capture screenshots at every test step, and emailable reports
- It can be easily integrated with frameworks like JUnit, NUnit, & TestNG
- It displays the time taken for test case execution
Generating Extent Reports In Selenium WebDriver
The main scope of this article is to show the Extent Reports. This is the most popular and widely used Selenium Reporting tool in the current market. Let’s see how to generate extent reports in Selenium WebDriver.
Extent Reports Version 4 – Latest Version 
Pre-requisites to Generate Extent Reports:
- Java should be installed – Install and setup Java
- TestNG should be installed – Install TestNG
- Extent Report Jars (Version 2.41.2) – Download
- extent-config.xml – It allows to configure HTML Report
Steps To Generate Extent Reports:
- Firstly, create a TestNG project in eclipse
- Now download extent library files from the following link: http://extentreports.relevantcodes.com/
- Add the downloaded library files to your project
- Create a java class say ‘ExtentReportsClass’ and add the following code to it
Selenium Continuous Integration With Jenkins [Maven – Git – Jenkins]
Check the below video to see “Extent Reports Complete Guide”
Please be patient. The video will load in some time.
If you liked this video, then please subscribe to our YouTube Channel for more video tutorials.
i. Imported two classes ExtentReports and ExtentTest.
ExtentReports: By using this class we set the path where our reports need to generate.
ExtentTest: By using this class we could generate the logs in the report.
ii. Took three methods with @Test annotation such as passTest, failTest and skipTest and a method startTest with @BeforeTest annotation and another method endReport with @AfterMethod annotation
Here my intention is to generate a report with all the three types of results such as Pass, Fail and Skip.
Add Screenshots of a failed Test Cases in Extent Reports
iii. Used object of ExtentReports class (i.e., extent) in the startReport method which was assigned to @BeforeTest annotation to generate the HTML report in the required path
iv. Used object of ExtentTest class (i.e., logger) in the remaining methods to write logs in the report.
v. Used ITestResult class in the @AfterMethod to describes the result of a test.
Given clear explanation in the comments section with in the program itself. Please go through it to understand the flow.