Chaitanya Maligi
Chaitanya Maligi

Reputation: 215

cucumber.runtime.CucumberException: Couldn't load plugin class: com.cucumber.listener.ExtentCucumberFormatter

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:

import java.io.File;

import org.junit.runner.RunWith;
import org.testng.annotations.AfterClass;

import com.vimalselvam.cucumber.listener.Reporter;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "C:\\Users\\User\\Desktop\\Cucumber - BDD\\CucumberPOM\\src\\main\\java\\com\\qa\\features\\DemoSite.feature"//path of the feature files
        ,glue = {"com/qa/stepDefinitions"} //path of the step definition files
        ,plugin = {"com.cucumber.listener.ExtentCucumberFormatter:target/html/ExtentReport.html"}
    //  ,plugin = {"pretty","html:test-output","json:json_output/cucumber.json","junit:junit_output/cucumber.xml"} //to generate diff types of reporting
        ,monochrome =true //display the console output in a proper readable format
        ,strict=true //it will check if any step is not defined in step definition file
        ,dryRun = false  //to check the mapping is proper btw feature file and step defn file
        //,tags = {"@FuntionalTest" , "~@SmokeTest" , "~@End2EndTest"}
        )

public class TestRunner {

    @AfterClass
    public static void writeExtentReport() {
        Reporter.loadXMLConfig(new File("config/extent-config.xml"));
    }  

}

I have included the below dependency for the Extent report in the POM.xml file:

<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.9</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.vimalselvam/cucumber-extentsreport -->
<dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.1.1</version>
</dependency>

<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
<version>1.0.7</version>
</dependency>

when I execute the above runner class im getting error - cucumber.runtime.CucumberException: Couldn't load plugin class: com.cucumber.listener.ExtentCucumberFormatter

Upvotes: 0

Views: 22287

Answers (2)

Felipe Luz
Felipe Luz

Reputation: 43

I'm having this similar issue, and to solve it I've changed the plugin in @CucumberOptions:

@CucumberOptions(
        plugin = { "com.vimalselvam.cucumber.listener.ExtentCucumberFormatter:path/report.html"}
)

But still, I'm facing another issues right now. I hope this helps

Upvotes: 4

Sureshmani Kalirajan
Sureshmani Kalirajan

Reputation: 1938

com.vimalselvam.cucumber.listener.ExtentCucumberFormatter is not supported in Cucumber version 4. If you are using cucumber 4, you have to use Cucumber Extent Adapter as plugin. see detailed documentation as how to use it in your framework here - http://extentreports.com/docs/versions/4/java/cucumber4.html

Upvotes: 2

Related Questions