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
Nice article.... Will it work for parallel execution dear ?
Replyjava.lang.NoClassDefFoundError: gherkin/formatter/Reporter
ReplyYes, lot has changed with newer versions of cucumber !!
ReplyCan you help with this error:
ReplyFAILED CONFIGURATION: @AfterClass writeExtentReport
java.lang.NullPointerException
at com.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:56)
at runner.Runner.writeExtentReport(Runner.java:37)
cucumber.runtime.CucumberException: Couldn't load plugin class: com.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin
Replyat 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)
Same issue, Failed configuration
ReplyMy code is working fine. Thank you Ankur Jain
ReplyDoesn't work. Got the plugin error first. Changed the plugin to "com.vimalselvam.cucumber.listener.ExtentCucumberFormatter:target/html/ExtentReport.html", now getting following error
Replyjava.lang.NoClassDefFoundError: gherkin/formatter/Reporter
Hi Ankur,
ReplyWith this code how to add screenshot for failed cases in extent report?
i am getting error as "Reporter cannot be resolved" .Please help
Reply