Rohan Sharma
Rohan Sharma

Reputation: 25

cucumber Extent reporting not working

I'm not using maven and downloaded cucumber-extentsreport 3.0.1.jar file.

I also added

plugin = "com.cucumber.listener.ExtentCucumberFormatter:output/report.html"

in cucumber test runner file.

but showing

cucumber.runtime.CucumberException: java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter
at cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:114)
at cucumber.runtime.formatter.PluginFactory.create(PluginFactory.java:87)
at cucumber.runtime.RuntimeOptions.getPlugins(RuntimeOptions.java:245)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:291)
at com.sun.proxy.$Proxy9.done(Unknown Source)
at cucumber.runtime.junit.JUnitReporter.done(JUnitReporter.java:227)
at cucumber.api.junit.Cucumber.run(Cucumber.java:101)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter
at com.cucumber.listener.ExtentCucumberFormatter.setExtentHtmlReport(ExtentCucumberFormatter.java:61)
at com.cucumber.listener.ExtentCucumberFormatter.<init>(ExtentCucumberFormatter.java:34)
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 cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:107)
... 12 more

Upvotes: 1

Views: 5197

Answers (4)

Md K
Md K

Reputation: 1

Try updating the tech.grasshopper extentreports to version 7 like so:

    <dependency>
            <groupId>tech.grasshopper</groupId>
            <artifactId>extentreports-cucumber7-adapter</artifactId>
            <version>1.14.0</version>
    </dependency>

This worked for me.

Upvotes: 0

nosequeweaponer
nosequeweaponer

Reputation: 668

Do the next for this issue:

Add the dependency (Version 4.0.9)

        <dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports</artifactId>
            <version>4.0.9</version>
        </dependency>

And these others:

    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports-cucumber3-adapter</artifactId>
        <version>1.0.2</version>
    </dependency>

    <dependency>
        <groupId>com.vimalselvam</groupId>
        <artifactId>cucumber-extentsreport</artifactId>
        <version>3.1.1</version>
    </dependency>

Works fine for me.

Upvotes: 0

vishal
vishal

Reputation: 1

Just now I figured out, I was also getting this error again and again and then I saw in the Maven dependencies in pom XML file I was having this dependency with tag

<scope>test<scope>

Removing this line works

Upvotes: 0

Anshoo
Anshoo

Reputation: 725

It looks like from the error that you are missing the extentreports dependency. Add this to your pom.xml:

<!-- pom.xml -->
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>3.1.1</version>
</dependency>

Here are the dependencies of the plugin: https://github.com/email2vimalraj/CucumberExtentReporter/blob/master/pom.xml

Upvotes: 2

Related Questions