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

Chaitanya Maligi picture Chaitanya Maligi · May 14, 2019 · Viewed 9.9k times · Source

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

Answer

Felipe Luz picture Felipe Luz · May 24, 2019

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