Skip to main content

Cucumber TestNG: Generate Extent Report using Extent Adapter (Grasshopper)

In previous article we generated Extent Report using Avent Stack TestNG Listener, in this articles let's do it using Grasshopper plugin technique.

Step 1: Add following dependency to your pom.xml. You can download the latest one from here.

<dependency>
    <groupId>tech.grasshopper</groupId>
    <artifactId>extentreports-cucumber7-adapter</artifactId>
    <version>1.2.0</version>
</dependency>

Step 2: Add adapter as a Plugin to your Cucumber Options:

Plugin

plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}

Runner File 

@CucumberOptions( 
        tags = (Constants.TAGS),
        glue = {Constants.GLUE}, 
        plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"},
        features = {Constants.FEATURES})

public class RunCucumberTest extends AbstractTestNGCucumberTests 
{	

}

Step 3: Add extent.properties to src/resources/test with below 2 lines

extent.reporter.spark.start=true
extent.reporter.spark.out=test-output/SparkReport/Spark.html

Step 4: Execute your Runner File

cucumber testng extent report generation

generate extent report using cucumber testng

Submitted by tgoswami on January 23, 2022

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.