Initializaton error in com.cucumber.listener.ExtentCucumberFormatter
Solution 1
You need to also add the Maven dependency for this formatter. Refer to this -- https://github.com/email2vimalraj/CucumberExtentReporter documents.
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>2.0.5</version>
</dependency>
But i think this only works with ExtentReport version 3 and above.
Solution 2
I was having com.cucumber.listener.ExtentCucumberFormatter initialization error but after few tweaks. I can generate the report now.
I added these two to my POM file. The version can be tricky as I used 3.1.1 for cucumber-extentreport but it didn't work for me. After trying a few 3.0.2 worked.
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.1</version>
</dependency>
My runner class looked like this:
package cucumber;
import java.io.File;
import org.junit.AfterClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources/features",
glue = {"stepDefinitions"},
plugin = {"com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"},
monochrome = true
)
public class CucumberRunner {
@AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File("config/report.xml"));
}
}
I hope this helps.
Solution 3
Try using a different version of cucumber-extentsreport. For me, the latest version (3.1.1) did not work, but 3.0.2 did.
Atif
Updated on June 05, 2022Comments
-
Atif almost 2 years
I am running the script using Cucumber in BDD Framework and I am using Extent Reports plugin to create the execution report.
I've created the test runner class as below:
package com.ctl.it.qa; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features = { "src/test/resources/Feature/ABC.feature" }, plugin = {"com.cucumber.listener.ExtentCucumberFormatter:BDDControlCenterTools/target/Reports/cucumber-report.html"} ) public class RunCukes { }
I have included the below dependency for the Extent report in the POM.xml file:
<dependency> <groupId>com.relevantcodes</groupId> <artifactId>extentreports</artifactId> <version>2.41.2</version> </dependency>
I am running the script with Junit and have the cucumber dependency for Junit too.
But when I execute the above runner class, its showing an Initialization error: cucumber.runtime.CucumberException: Couldn't load plugin class: com.cucumber.listener.ExtentCucumberFormatter
Can anyone please help in this error and help to resolve it.