top of page

Extent Report Cucumber6 Adapter Not Working with Selenium TestNG + Cucumber


Test reporting tools provide information about the test accuracy. They can help us in early bug detection, easier analysis and track progress. One of the most popularly used reporting tool for Selenium is ExtentReports. An Extent report is a customized HTML-based report integrated with Selenium using the TestNG framework and Junit framework.

Additionally, the Extent report has many benefits over TestNG's built-in default report, including eye-catching pie charts, step-by-step explanations, screenshots, etc. Everything is packaged in a tidy, professional UI that is simple to share with other project stakeholders.

In this article, lets discuss what to do if ExtentReports Cucumber6 Adapter fails to generate the report. If you get the below shown error, try upgrading to ExtentReports Cucumber7 Adapter. The adapter plugin is available in the tech.grasshopper groupid in Maven repository.

The Cucumber7 adapter generates reports such as Spark, Json, Custom PDF report, Logger and HTML reports. Other new capabilities include the ability to upload base64 string images, configure report folder names with timestamps, and modify the order in which Spark reports are displayed.

Let's look at the steps to integrate the Extent report for cucumber 7 that is integrated with TestNG, Selenium Java and Maven project.

Step 1: POM Dependencies

For Java8+ Maven build project add the following dependencies to pom.xml file

Step 2: Report Activation:

To activate report generation, create file @ src/main/resources folder of the project and add below properties. The grasshopper extent report adapter recognizes the file in resource folder and reads all the properties.

Let’s understand more about file

a. For Spark Report Activation:

Add the below two lines in

b. For Report Attachments:

Two parameters must be added to the in order to add attachments, like screen shots.

screenshot.dir: The directory where the attachments are kept is indicated by the first attribute. screenshot.rel.path: The relative path from the report file to the screenshot directory and it comes in second.

The Spark report, which by default is called index.html, will use the relative path setting in the configuration below to browse to the saved attachments.

c. For PDF Extent Report:

The PDF report is needs to be enabled in the file.

Do not use this report if the setup contains multiple runners as concurrent modification of the same PDF will result in errors. Better solution would be using a Maven plugin for creating just the PDF report or the complete ExtentReport suite.

d. For Ported HTML Extent Report:

The HTML report needs to be enabled in the file.

To change settings like theme, title, encoding, offlineMode etc, a separate xml file eg. html-config.xml is required

e. For Customized Report Folder Name:

To enable report folder name with date and\or time details, two settings need to be added to the These are and basefolder.datetimepattern.

With the above settings, my base folder name is : ExtendReports/SparkReports-20-NOV-22 21-48-08 which contains all the reports.

f. For Spark report view order:

The default tab view order of the Spark reporter is – test, exception, category, device, author, log, dashboard tabs. By adding extent.reporter.spark.vieworder property , the order can be changed.

The value needs to be a comma delimited text without any spaces. Any error in parsing will use the default view order. To restrict the number of tabs, just mention the name of the required tabs. For example, if only the test and dashboard views are needed use the below setting.

g. For Attach Image Base64 String:

This feature can be used to attach images to the Spark report by setting the src attribute of the img tag to a Base64 encoded string of the image. No physical file is produced when this functionality is used. To use this, there is no need to change any step definition code. Use the following settings, which are set to false by default, to enable this.

Step 3: Report Settings

To configure Spark.html report, a separate xml file, such as extent-config.xml, is needed to alter parameters like theme, Report title, Document title, encoding etc. When executed through Jenkins, the https protocol of style sheets and script files are blocked, so customization is needed.

Create extent-config.xml file @ src/main/ resources folder of the project and add below properties

Step 4: Plugin Configuration

Configure Test Runner class to Implement Cucumber Extent Reporter.Add the extentreports-cucumber7-adapter plugin to the CucumberOption annotation present in the test runner class.

Let’s understand more about Cucumber options:

a. dryRun:

You can set the dryRun option to true or false. If set to true, Cucumber will simply examine whether or not each Step specified in the Feature File has corresponding code written in the Step Definition file.

b. monochrome:

You can either select true or false for this option. The console output for the Cucumber test is considerably easier to read if it is set to true. The console output is not as readable as it should be if it is set to false.

c. features:

Cucumber uses the Features Options to assist it find the Feature file in the project folder hierarchy. Cucumber will automatically locate all files with the “. features" extension in the folder if we just supply the folder path.

It can be specified like:

features = "Feature"

Or if the Feature file is in the deep folder structure

features = "src/test/features"

d. glue:

Cucumber uses the Glue Options to locate the Step Definition file. Whenever Cucumber encounters a Step, it looks for a Step Definition inside all the files present in the folder mentioned in Glue Option

It can be specified like:

glue = "stepDefinition"

Or if the Step Definition file is in the deep folder structure

glue = "src/test/stepDeinition"

e. plugin:

For HTML reports, add html: target/cucumber-reports .html to plugin option.

For JSON reports, add json:target/cucumber-reports/Cucumber.json to plugin option.

For JUNIT reports, add junit:targe/cucumber-reports/Cucumber.xml to plugin option.

For Extent reports, add com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter: to plugin option.

Step 5: Run your Runner file

The output of the Test Execution looks like below

Step 6: Let’s see how the generated reports look like

Extent PDF Report:

The PDF report generated contains six sections – dashboard, summary, tags, features, scenarios, and detailed sections.

Spark HTML Report:

Provides pie charts and stepwise report that visually summarize the test scripts.


As we have only one failed step, only one screenshot has been captured as seen in the below image.

Ported HTML Extent Report:


  • Extent reports produce simple, aesthetically pleasing reports with a dashboard and graphical view. The HTML-based report can also be simply distributed to other stakeholders to make wise decisions.

  • Furthermore, Cucumber TestNG is not directly supported by the extent report. To create the necessary reports, we can, however, use the adapter plugin.

  • Additionally, plugin integration enables customers to alter reports in a variety of ways to suit their requirements.

  • Captures screenshots at every test step

195 views1 comment

Recent Posts

See All
bottom of page