Initializaton error in com.cucumber.listener.ExtentCucumberFormatter

Atif picture Atif · Jun 15, 2017 · Viewed 13.7k 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:

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.

Answer

Grasshopper picture Grasshopper · Jun 15, 2017

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.