Skip to main content

Cucumber Extent Report using Cucumber 6 Adapter

Recently in June 2020, Cucumber 6 has been launched. Cucumber 4 or 5 adapter libraries will not work with cucumber 6. Grasshopper team is very fast in launching the latest adapter, within couple of days of launching cucumber they have launched their adapter.

To integrate extent report using cucumber 5 adapter follow below steps:

Step 1: In pom.xml add following dependency, you can check the latest version of depedency from their official website by clicking here:

<dependency>
   <groupId>tech.grasshopper</groupId>
   <artifactId>extentreports-cucumber6-adapter</artifactId>
   <version>1.0.0</version>
</dependency>

Step 2: Update TestRunner file with following plugin, add below line inside @CucumberOptions:

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

You need to replace with existing plugin.

Step 3: Create extent.properties file in resources folder and paster below code:

extent.reporter.avent.start=false
extent.reporter.bdd.start=false
extent.reporter.cards.start=false
extent.reporter.email.start=false
extent.reporter.html.start=true
extent.reporter.klov.start=false
extent.reporter.logger.start=true
extent.reporter.tabular.start=false

extent.reporter.avent.config=
extent.reporter.bdd.config=
extent.reporter.cards.config=
extent.reporter.email.config=
extent.reporter.html.config=
extent.reporter.klov.config=
extent.reporter.logger.config=
extent.reporter.tabular.config=

extent.reporter.avent.out=test-output/AventReport/
extent.reporter.bdd.out=test-output/BddReport/
extent.reporter.cards.out=test-output/CardsReport/
extent.reporter.email.out=test-output/EmailReport/ExtentEmail.html
extent.reporter.html.out=test-output/HtmlReport/ExtentHtml.html
extent.reporter.logger.out=test-output/LoggerReport/
extent.reporter.tabular.out=test-output/TabularReport/

screenshot.dir=test-output/
screenshot.rel.path=../

After switching to cucumber 6 you are getting some error in cucumber runner class, you need to remove strict option or set its value to true. Also use round () brackets for tags instead of curly brackets {}. For example:

tags = ("@SmokeTest")

Submitted by tgoswami on August 30, 2020

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.