Cucumber Extent Report

Cucumber Extent Report
In this blog, we are going to learn, how we can generate the extent report for the cucumber project.


How to Send Cucumber Report in email through Jenkins


Let’s check out how we can generate the extent report for Cucumber. 

1)   In POM.Xml please add below maven dependencies.



2)   Add extent-config.xml file under test/resources in your maven project.



And add below code inside it




3)   In the Runner File under plugin please add below code 
 


Also, add below code in After class of runner file.


Now, after executing the code extent report would be generated inside /target/html folder and it would be looking something like this









SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post
November 28, 2018 at 8:00 AM

Nice article.... Will it work for parallel execution dear ?

Reply
avatar
March 21, 2019 at 3:21 PM

java.lang.NoClassDefFoundError: gherkin/formatter/Reporter

Reply
avatar
Anonymous
June 18, 2019 at 10:13 AM

Yes, lot has changed with newer versions of cucumber !!

Reply
avatar
June 25, 2019 at 3:03 AM

Can you help with this error:

FAILED CONFIGURATION: @AfterClass writeExtentReport
java.lang.NullPointerException
at com.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:56)
at runner.Runner.writeExtentReport(Runner.java:37)

Reply
avatar
November 21, 2019 at 12:18 PM

cucumber.runtime.CucumberException: Couldn't load plugin class: com.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin
at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:177)
at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:164)
at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:221)
at cucumber.runtime.formatter.PluginFactory.isStepDefinitionReporterName(PluginFactory.java:204)
at cucumber.runtime.RuntimeOptions$ParsedPluginData.addPluginName(RuntimeOptions.java:440)
at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:198)
at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:118)
at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:111)
at cucumber.runtime.RuntimeOptions.(RuntimeOptions.java:107)
at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:23)
at cucumber.api.junit.Cucumber.(Cucumber.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Reply
avatar
January 23, 2020 at 3:40 PM

My code is working fine. Thank you Ankur Jain

Reply
avatar
Anonymous
March 6, 2020 at 6:40 PM

Doesn't work. Got the plugin error first. Changed the plugin to "com.vimalselvam.cucumber.listener.ExtentCucumberFormatter:target/html/ExtentReport.html", now getting following error
java.lang.NoClassDefFoundError: gherkin/formatter/Reporter

Reply
avatar
Anonymous
May 20, 2020 at 7:06 PM

Hi Ankur,
With this code how to add screenshot for failed cases in extent report?

Reply
avatar
August 6, 2020 at 6:07 PM

i am getting error as "Reporter cannot be resolved" .Please help

Reply
avatar