Skip to content

How to Add Extent Report in Selenium-Cucumber Framework

Extent Report

What is ExtentReport?

Extent Report is a powerful, open-source library used in testing automation frameworks for generating beautiful and user-friendly HTML reports. It allows the user to customize the report template by using custom CSS, JSON, or XML.
You can read more about it at


Create Maven Project
Add Cucumber Java dependence.
Add TestNG Dependence.

Steps to follow:

a) Add extent reports-cucumber6-adapter dependency in the pom.xml file.


b) Create a file named “extent. properties” in the src/test/resources folder.

Add the following lines to the file.

basefolder.datetimepattern=d-MMM-YY HH-mm-ss
systeminfo.user={User name}{Build version}
systeminfo.AppName={App name}

c) Add the Plugin in class

		features = { "src/test/resources/features" }, 
		glue = { "path of your step definition" }, 
		plugin = { "pretty",
		"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:" } 

After completing all the setup and configuration run your TestRunner class and then refresh the project. A base folder will be created named reports, inside which a beautiful HTML report will be generated as:


We can configure the extent report using an XML file or JSON file as well.

Extent Report configuration using XML:

To configure the extent report using XML we need to create an extent-config.xml file in the src/test/resources folder. Add the below configuration in the XML file.

<?xml version="1.0" encoding="UTF-8"?>
		<!-- report theme -->

		<!-- standard, dark -->

		<!-- document encoding -->

		<!-- defaults to UTF-8 -->

		<!-- protocol for script and stylesheets -->

		<!-- defaults to https -->

		<!-- title of the document -->
		<!-- report name - displayed at top-nav -->

		<reportName>App Web Report</reportName>
		<!-- location of charts in the test view -->

		<!-- top, bottom -->

		<!-- custom javascript -->


$(document).ready(function() {
		<!-- custom styles -->

Other steps will remain the same. Execute your script and refresh the project. The report will generate inside the target/Html folder.

Customize Report Folder: When we execute the test script then the previous report will be overridden and a new report will generate. To overcome this we need to maintain the backup of all the test execution results. To do this we can add two properties to the properties file.
basefolder.datetimepattern=d-MMM-YY HH-mm-ss

If there is a requirement to attach the screenshot to the extent report that can also be achieved by adding a few more properties to the .properties file.


There are a few more properties that can be used to customize the extent reports as per the requirement. By Doing so users can get a more extensive and insightful perspective on the test results.