0

Error when running the TestRunner file

Java.lang.NoClassDefFoundError: gherkin/formatter/Reporter
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
    at java.base/

Updated all the dependencies to current versions

POM.xml

  <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>latest</groupId>
      <artifactId>corp</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>jar</packaging>

      <name>corp</name>
      <url>http://maven.apache.org</url>

      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>

      <dependencies>
      <dependency>
    <groupId>com.vimalselvam</groupId>
    <artifactId>cucumber-extentsreport</artifactId>
    <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>3.0.7</version>
        <scope>provided</scope>
    </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId>
        <version>1.5</version>
    </dependency>
    <dependency>
        <groupId>org.apache.directory.studio</groupId>
        <artifactId>org.apache.commons.io</artifactId>
        <version>2.4</version>
    </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.12</version>
        </dependency>
        <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>4.2.2</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>4.2.2</version>
        </dependency>

      </dependencies>

      <build>
        <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M3</version>
    <!--    <configuration>
        <includes>
        <excludes>**/*TestRunnertest.java</excludes>
        </includes>
        </configuration> -->
        </plugin>

                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                      <source>1.8</source>
                      <target>1.8</target>
                       <encoding>UTF-8</encoding>          
                    </configuration>
                  </plugin>   

      </plugins>
      </build>
    </project>
Bless
  • 5,052
  • 2
  • 40
  • 44
Neha
  • 11
  • 3

1 Answers1

0

A bit of research would have helped you as It's already been noticed

This issue came due to an incompatible combination of selenium and gherkin dependency. Try changing the gherkin dependency version this issue will be resolved. Here are the suggested versions that might help you

use cucumber 2.4.0 and gherkin 5.1.0

and do check this link as well.

Community
  • 1
  • 1
Clover
  • 507
  • 7
  • 22