I am trying to generate Extent report for my test run using Junit cucumber ,but i am getting error
\"cucumber.runtime.CucumberException: Couldn\'t load plugin c
After many days searching for a solution to this problem that was also happening to me, I discovered the cause (at least that worked for me). Apparently, the pluggin com.cucumber.listener.ExtentCucumberFormatter or com.vimalselvam.cucumber.listener.ExtentCucumberFormatter (for cucumber-extentreports version 3.1.1+) only works with the cucumber of the info.cukes package.
<! - https://mvnrepository.com/artifact/info.cukes/cucumber-java ->
<dependency>
<groupId>info.cukes</ groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</ version>
</dependency>
To use ExtentReports with the most current cucumber versions (package io.cucumber from versions 2.X.X onwards) you need to add the cucumber-adapter plugin.
For each X version of cucumber, there is an adapter, such as for cucumber version 4.X.X the extentreports-cucumber4-adapter dependency is required.
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
<version>1.0.7</version>
</dependency>
And in the class Runner you should replace the plugin:
"com.cucumber.listener.ExtentCucumberFormatter:"
by
"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"
For an example of using cucumber 4 with extent reports follow the GitHub link I found:
https://github.com/foursyth/extentreports-cucumber4-example
For versions 2.X.X and 3.X.X follow the same principles as 4.X.X
ExtentReport settings specification link of all versions:
http://extentreports.com/documentation/
Hope this helps.
Advise is to upgrade your cucumber v to 4.x.x. Doing so would not only resolve your error rather you would be able to generate consolidated report during parallel execution as well without creating runners manually.
There are 2 ways of implementing extent report in Cucumber :
1. Using Cucumber-JVM 4 adapter for Extent Framework(extentreports-cucumber4-adapter) - Beauty is, you do not need to write any code any where to generate report this way except from setting adapter in runner below.
Add adapter dependency under POM.XML
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
<version>1.0.6</version>
</dependency>
Add the com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter plugin to the runner.
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"})
public class RunCukesTest {
// ..
}
Report Output Directory - ../Project Directory/test-output/HtmlReport
2. Adding aventstack dependency under POM.XML
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.5</version>
</dependency>
In this workflow, Do not Add the com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter plugin to the runner.