Since Cucumber JVM version 7 is out in October 2021. Let’s test this version with the corresponding extent Adapter dependency provided by Grasshopper today.
If you are using TestNG do watch the TestNG specific video, although the steps are quite similar.
- Cucumber TestNG: Generate Extent Report using Extent Adapter
- Cucumber TestNG: Generate Extent Report using Extent Adapter (Grasshopper)
Now, if you are working on an older version of Cucumber JVM, on the programsbuzz website you will find a corresponding article for it.
- Cucumber report generation using Extent Report Cucumber 4 Adapter
- Cucumber report generation using Extent Report Cucumber 5 Adapter (Grasshopper)
- Cucumber report generation using Extent Report Cucumber 6 Adapter (Grasshopper)
Step 1: Add tech grasshopper cucumber adapter maven dependency
<!-- https://mvnrepository.com/artifact/tech.grasshopper/extentreports-cucumber7-adapter -->
<dependency>
<groupId>tech.grasshopper</groupId>
<artifactId>extentreports-cucumber7-adapter</artifactId>
<version>1.9.2</version>
</dependency>
This article was tested with Cucumber version 7.9.0.
Step 2: Create extent.properties file in src/test/resources/
Note: The original HTML Extent Reporter was deprecated in extent report version 4.1.3 and removed in 5.0.0. ExtentReports has been updated to version 5, which has resulted in multiple reporters getting deprecated. So you have to make sure which reporter you are enabling in the extent properties file.
Let’s enable spark report in an extent properties file:
extent.reporter.spark.start=true
extent.reporter.spark.out=test-output/SparkReport/Spark.html
Step 3: Add the plugin
plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}
Step 4: Execute your code
For screenshot refer Add Screenshot in Cucumber Extent Report.