email2vimalraj / CucumberExtentReporter

A plugin to generate the cucumber jvm custom html report using ExtentsReport
http://www.vimalselvam.com/cucumber-extent-reporter/
MIT License
58 stars 75 forks source link

java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter #121

Open KonkaKrish opened 3 years ago

KonkaKrish commented 3 years ago

Getting Below error, please help me guys spent a lot of time to fix this issue and no luck so far

Not getting extent reports - tried many ways and got struck, provided below my POM.xml and runner file- much appreciate your help in advance!


FAILED CONFIGURATION: @AfterClass extentReport java.lang.NoClassDefFoundError: com/aventstack/extentreports/reporter/ExtentHtmlReporter at com.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:56) at com.API.runner.CucumberRunner.extentReport(CucumberRunner.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:514) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:215) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142) at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:232) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:115) at org.testng.TestRunner.privateRun(TestRunner.java:782) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at org.testng.SuiteRunner.run(SuiteRunner.java:268) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244) at org.testng.TestNG.runSuitesLocally(TestNG.java:1169) at org.testng.TestNG.run(TestNG.java:1064) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177) Caused by: java.lang.ClassNotFoundException: com.aventstack.extentreports.reporter.ExtentHtmlReporter at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 26 more #

My POM.xml -----------------

4.0.0 Cucumber_API Cucumber_API 0.0.1-SNAPSHOT UTF-8 UTF-8 1.8 org.testng testng 6.9.9 org.apache.poi poi 4.0.1 org.apache.poi poi-ooxml 4.0.1 org.apache.poi poi-ooxml-schemas 4.0.1 io.rest-assured rest-assured 4.1.2 com.aventstack extentreports 5.0.6 com.relevantcodes extentreports 2.41.2 com.vimalselvam cucumber-extentsreport 3.1.1 info.cukes cucumber-testng 1.2.6 net.masterthought cucumber-reporting 5.4.0 info.cukes cucumber-java 1.2.6 pom info.cukes cucumber-jvm-deps 1.0.5 provided info.cukes cucumber-picocontainer 1.2.6 info.cukes cucumber-junit 1.2.6

Runner.Java ----------------- import java.io.File; import org.testng.annotations.AfterClass; import com.API.report.reportHelp; import com.cucumber.listener.Reporter; import cucumber.api.CucumberOptions; import cucumber.api.testng.AbstractTestNGCucumberTests;

@CucumberOptions(strict = true, monochrome = true, features = "src/test/resources/features", glue = "com.API.StepDef", plugin = {
        "pretty", "json:target/cucumber.json","com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"})

public class CucumberRunner extends AbstractTestNGCucumberTests {

    @AfterClass(alwaysRun = true)
    public void extentReport() throws Exception {
        Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml"));

    }

}
StefaneAL commented 3 years ago

What if you try to use "com.vimalselvam.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html" instead of "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"

assuming that

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

or replace

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

for

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

Good luck