unable to add extent report in Cucumber Maven in java 1.8.0.45 version

Hi ,

 

I am following your tutorial(http://toolsqa.com/selenium-cucumber-framework/cucumber-extent-report/) completely for Cucumber framework. when i try to add the extent reports in POM.xml file i am getting the below error.

cucumber.runtime.CucumberException: Couldn’t load plugin class: com.cucumber.listener.ExtentCucumberFormatter. It does not implement cucumber.api.Plugin
at cucumber.runtime.formatter.PluginFactory.loadClass(PluginFactory.java:179)
at cucumber.runtime.formatter.PluginFactory.pluginClass(PluginFactory.java:166)
at cucumber.runtime.formatter.PluginFactory.getPluginClass(PluginFactory.java:223)
at cucumber.runtime.formatter.PluginFactory.isFormatterName(PluginFactory.java:201)
at cucumber.runtime.RuntimeOptionsFactory.addPlugins(RuntimeOptionsFactory.java:94)
at cucumber.runtime.RuntimeOptionsFactory.buildArgsFromOptions(RuntimeOptionsFactory.java:41)
at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:26)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:75)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:87)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:73)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:46)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:522)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

 

Even though i have added the extent report version as 3.1.2. My POM file below :

<project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
<modelVersion>4.0.0</modelVersion>
<groupId>AlexBase</groupId>
<artifactId>demo1</artifactId>
<version>0.0.1-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>

<name>Cucumber Extents Report</name>
<description>A custom cucumber html report generated by ExtentsReport</description>
<url>http://vimalselvam.com</url>

<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>

<issueManagement>
<url>https://github.com/email2vimalraj/CucumberExtentReporter/issues</url>
<system>GitHub Issues</system>
</issueManagement>

<scm>
<url>https://github.com/email2vimalraj/CucumberExtentReporter</url>
<connection>scm:git:git://github.com/email2vimalraj/CucumberExtentReporter.git</connection>
<developerConnection>scm:git:git@github.com/email2vimalraj/CucumberExtentReporter.git</developerConnection>
</scm>

<developers>
<developer>
<name>Vimalraj Selvam</name>
<url>http://vimalselvam.com</url>
<id>email2vimalraj</id>
<roles>
<role>Owner</role>
</roles>
</developer>
</developers>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cucumber.version>3.0.2</cucumber.version>
<extentreports.version>3.1.2</extentreports.version>
</properties>

<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>2.4.0</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-html</artifactId>
<version>0.2.7</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.4.0</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.6</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>2.4.0</version>
<type>pom</type>
</dependency>

<!– https://mvnrepository.com/artifact/io.cucumber/cucumber-junit –>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>

<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.2</version>
</dependency>

<!– https://mvnrepository.com/artifact/info.cukes/gherkin –>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<type>maven-plugin</type>
</dependency>

</dependencies>
</project>

My test runner class :

package runnerClass;

import java.io.File;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import com.cucumber.listener.ExtentProperties;
import com.cucumber.listener.Reporter;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
features = {“target/Features”},
glue= {“stepDefinitions”,”basepage”},
plugin = {“com.cucumber.listener.ExtentCucumberFormatter:output/myreport.html”})
// “/User Maintanence/CaseQuery.feature:5”
//format = {“junit:D:\\Cucumberresult/cucumber.xml”})
//format = {“pretty”})

public class TestRunner
{

@BeforeClass
public static void setup()
{
ExtentProperties extentProperties = ExtentProperties.INSTANCE;
extentProperties.setReportPath(“output/myreport.html”);
}

@AfterClass
public static void writeExtentReport()
{
Reporter.loadXMLConfig(new File(“src/main/java/Config.properties”));
Reporter.setSystemInfo(“user”, System.getProperty(“user.name”));
Reporter.setSystemInfo(“os”, “Mac OSX”);
Reporter.setTestRunnerOutput(“Sample test runner output message”);
}

}

 

 

one more query if i add @Beforeclass and @Afterclass and runnin with Junitrunner, its not invoking the before and after class methods.

 

Highly appreciate your help.

 

Add Comment
  • 1 Answer(s)

    Hi. Any solution?

    Default Answered on November 25, 2018.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.