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 74 forks source link

Not able to run any scenario after implementing extent report - getting this error - cucumber.runtime.CucumberException: java.lang.NoSuchFieldError: VERSION_2_3_23 #96

Closed dchoub closed 6 years ago

dchoub commented 6 years ago

Dependency added in POM are:

com.relevantcodes extentreports 2.41.2
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
 </dependency>
 <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>3.1.5</version>
    <scope>provided</scope>
</dependency>
    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.23</version>
    </dependency>

Added below after method in Test Runner class: @RunWith(Cucumber.class) @CucumberOptions( plugin={"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"}, features = {"src/test/resources/feature"}, glue ={"com.mindstrength.stepdefs"}, tags={"@Profile"}

) public class RunTest { @AfterClass public static void setup() { Reporter.loadXMLConfig(new File("src//test//resources//extent-config.xml")); Reporter.setSystemInfo("user", System.getProperty("user.name")); Reporter.setSystemInfo("os", "Mac OSX"); Reporter.setTestRunnerOutput("Sample test runner output message"); }

getting below error in console cucumber.runtime.CucumberException: java.lang.NoSuchFieldError: VERSION_2_3_23 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:241) at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:287) at com.sun.proxy.$Proxy14.uri(Unknown Source) at cucumber.runtime.junit.JUnitReporter.uri(JUnitReporter.java:160) at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:68) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93) at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at cucumber.api.junit.Cucumber.run(Cucumber.java:98) 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:538) 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) Caused by: java.lang.NoSuchFieldError: VERSION_2_3_23 at com.aventstack.extentreports.reporter.ExtentHtmlReporter.start(ExtentHtmlReporter.java:93) at com.aventstack.extentreports.Report.attach(Report.java:55) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) at com.aventstack.extentreports.ExtentReports.attachReporter(ExtentReports.java:68) at com.cucumber.listener.ExtentCucumberFormatter.setExtentReport(ExtentCucumberFormatter.java:77) at com.cucumber.listener.ExtentCucumberFormatter.(ExtentCucumberFormatter.java:36) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at cucumber.runtime.formatter.PluginFactory.instantiate(PluginFactory.java:107) ... 22 more

email2vimalraj commented 6 years ago

As mentioned in the README, the CucumberExtentReporter v3.0.2 supports ExtentReport from v3.1.1 only. Kindly upgrade your extent report version from v2.41.2 to the latest one. Thanks.

dchoub commented 6 years ago

I have already added 3.1.5 version which is latest so I dont think so version is the issues.

com.aventstack extentreports 3.1.5 provided
email2vimalraj commented 6 years ago

@dchoub : Can you please provide your entire pom.xml file?

dchoub commented 6 years ago

<?xml version="1.0" encoding="UTF-8"?> <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">

4.0.0
<groupId>com.mindstrength</groupId>
<artifactId>mindstrength</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Spring Boot Docker Blank Project (from https://github.com/making/spring-boot-docker-blank)</name>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.5.RELEASE</version>
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <start-class>com.mindstrength.App</start-class>
    <java.version>1.8</java.version>
    <docker.image.prefix>${user.name}</docker.image.prefix>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.6</version>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.3.0</version>
    </dependency>
    <!--Selenium -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.0</version>
    </dependency>

<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.2</version>
 </dependency>
 <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.5</version>
</dependency>

<dependency>
    <groupId>org.freemarker</groupId>
    <artifactId>freemarker</artifactId>
    <version>2.3.23</version>
</dependency>

    <!-- Java mail api -->
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>1.2.5</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.4</version>
    </dependency>       
   <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1.1</version>
   </dependency>
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.2</version>
</dependency>
</dependencies>
<build>
    <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
               <encoding>UTF-8</encoding>          
            </configuration>
          </plugin>                          
    </plugins>
</build>

dchoub commented 6 years ago

@email2vimalraj I have posted the POM file in above comment

email2vimalraj commented 6 years ago

@dchoub : You have freemarker added in your dependency. It could be the reason for the exception you get as ExtentReport also have that dependency. Can you please remove the freemarker dependency and check.

dchoub commented 6 years ago

I already tried this but same error. tried again and error is same only

email2vimalraj commented 6 years ago

@dchoub : Unable to reproduce your issue. I'm able to successfully run exactly with your pom dependencies. Please find the attached example project.

issue96.zip

dchoub commented 5 years ago

I tested your project in my machine and its working fine. I also re compiled my project and changed Runner class name from RunTest to test and run it using mvn test command and its successfully able to generate the report.

But when I am running using eclipse its still giving me same error but for your sample project its working perfectly fine. :(

email2vimalraj commented 5 years ago

Cool. That means Eclipse is playing a game with your Java class path. Check your Eclipse settings. It is nothing to do with the class name.

On 05-Jul-2018 6:44 PM, "dchoub" notifications@github.com wrote:

I tested your project in my machine and its working fine. I also re compiled my project and changed Runner class name from RunTest to test and run it using mvn test command and its successfully able to generate the report.

But when I am running using eclipse its still giving me same error but for your sample project its working perfectly fine. :(

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/email2vimalraj/CucumberExtentReporter/issues/96#issuecomment-402717570, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKI3ny9Ys0rgnXvKXiXQ_QRkaxo6Qziks5uDhElgaJpZM4Ung65 .

chiran1729 commented 3 years ago

@dchoub : You have freemarker added in your dependency. It could be the reason for the exception you get as ExtentReport also have that dependency. Can you please remove the freemarker dependency and check.

Thank you so much. It helped me. :) Cheers..!!

ZeynepUsta commented 3 years ago

@dchoub : You have freemarker added in your dependency. It could be the reason for the exception you get as ExtentReport also have that dependency. Can you please remove the freemarker dependency and check.

Thank you so much. It helped me. :) Cheers..!!

Helped me too! Thanks!