java.lang.AbstractMethodError: io.cucumber.testng.TestNGCucumberOptionsProvider$TestNGCucumberOptions.publish()Z

My project uses project is cucumber + POM + testng + Maven + extent report 5

I am facing this issue and would appreciate help to resolve it:

Results :

Failed tests: 
  TestRunner>AbstractTestNGCucumberTests.setUpClass:23 » AbstractMethod io.cucum...

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[ERROR] There are test failures.

POM

<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>com.XXX</groupId>
    <artifactId>XXXX</artifactId>
    <version>0.0.1-SNAPSHOT</version>


    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.test.failure.ignore>true</maven.test.failure.ignore>
        <aspectj.version>1.8.10</aspectj.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.7</version>
        </dependency>

        <!-- http://mvnrepository.com/artifact/org.apache.poi/poi -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.9</version>
        </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>5.0.6</version>
        </dependency>
        <dependency>
            <groupId>tech.grasshopper</groupId>
            <artifactId>extentreports-cucumber6-adapter</artifactId>
            <version>2.8.1</version>
            <scope>test</scope>
        </dependency>
        <!-- http://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.9</version>
        </dependency>
        <!-- http://mvnrepository.com/artifact/dom4j/dom4j -->
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.1</version>
        </dependency>

        <!-- http://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- http://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.9</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.141.59</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>6.8.1</version>
        </dependency>

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>6.1.1</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
        <!-- <dependency> <groupId>io.cucumber</groupId> <artifactId>gherkin</artifactId> 
            <version>5.1.0</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>info.cukes</groupId> <artifactId>cucumber-jvm-deps</artifactId> 
            <version>1.0.5</version> <scope>test</scope> </dependency> -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>6.1.1</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>3.15.0</version>
        </dependency>
        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>2.13.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 -->
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>18.3.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.6</version>

        </dependency>

        <!-- <dependency> <groupId>com.sun.mail</groupId> <artifactId>javax.mail</artifactId> 
            <version>1.5.1</version> </dependency> -->

        <!-- <dependency> <groupId>org.apache.hive</groupId> <artifactId>HiveJDBC41</artifactId> 
            <version>4.1</version> </dependency> <dependency> <groupId>ql</groupId> <artifactId>ql</artifactId> 
            <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.thrift</groupId> 
            <artifactId>libfb303</artifactId> <version>0.9.0</version> <type>pom</type> 
            </dependency> <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> 
            <version>0.9.0</version> <type>pom</type> </dependency> <dependency> <groupId>org.slf4j</groupId> 
            <artifactId>slf4j-api</artifactId> <version>1.5.11</version> </dependency> 
            <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-metastore</artifactId> 
            <version>1.0.0</version> </dependency> <dependency> <groupId>org.apache.hive</groupId> 
            <artifactId>hive-service</artifactId> <version>1.0.0</version> </dependency> 
            <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> 
            <version>1.5.11</version> <scope>test</scope> </dependency> <dependency> 
            <groupId>com.cloudera.impala.jdbc</groupId> <artifactId>TCLIServiceClient</artifactId> 
            <version>2.5.41</version> </dependency> -->


    </dependencies>
    <build>

        <defaultGoal>verify</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    </argLine>
                    <suiteXmlFiles>
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>

            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version> <!-- or whatever current version -->
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>

            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.kub.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>



            <plugin>
                <groupId>net.masterthought</groupId>
                <artifactId>maven-cucumber-reporting</artifactId>
                <version>3.15.0</version>
                <executions>
                    <execution>
                        <id>execution</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>generate</goal>

                        </goals>

                        <configuration>
                            <projectName>TradeSurveillance</projectName>
                            <outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
                            <cucumberOutput>target/cucumber-reports/CucumberTestReport.json</cucumberOutput>
                            <buildNumber>1</buildNumber>
                            <parallelTesting>false</parallelTesting>
                            <maven.test.failure.ignore>true</maven.test.failure.ignore>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

runner

package com.Markets.XXXX;


import org.testng.annotations.DataProvider;

import io.cucumber.testng.*;

@CucumberOptions(
            features = "src/test/resources/Features",
            glue = {"com.Markets.Step_Definations"},
            monochrome=true,
            tags= "@NAM_TC01",
            plugin = {
                    "pretty","com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",                
                    "html:target/cucumber-reports/cucumber-pretty",
                    "json:target/cucumber-reports/CucumberTestReport.json",
                    "junit:target/cucumber-reports/Cucumber.xml",
                    "rerun:target/cucumber-reports/rerun.txt"
            })
 
 
 
    public class TestRunner extends AbstractTestNGCucumberTests {
            
        
          @Override
          @DataProvider(parallel = true) 
          public Object[][] scenarios() { 
              return  super.scenarios(); 
              }
         


    /*
     * @BeforeClass(alwaysRun = true) public void setUpClass() throws Exception {
     * testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
     * 
     * 
     * }
     * 
     * @Test(groups = "cucumber", description = "Runs Cucumber Feature",
     * dataProvider = "features") public void feature(CucumberFeatureWrapper
     * cucumberFeature) {
     * testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
     * 
     * }
     * 
     * @DataProvider public Object[][] features() { return
     * testNGCucumberRunner.provideFeatures(); }
     * 
     * @AfterClass(alwaysRun = true) public void tearDownClass() throws Exception {
     * 
     * testNGCucumberRunner.finish();
     * 
     * }
     * 
     * @AfterClass public void writeExtentReport() {
     * 
     * 
     * Reporter.loadXMLConfig(
     * "C:\\Users\\AR06344\\git\\trade_surveillance_qa\\src\\test\\java\\extent-config.xml"
     * ); Reporter.setSystemInfo("User Name", System.getProperty("user.name"));
     * Reporter.setSystemInfo("Time Zone", System.getProperty("user.timezone"));
     * Reporter.setSystemInfo("Machine", "Windows 10" + "64 Bit");
     * Reporter.setSystemInfo("Selenium", "3.14");
     * Reporter.setSystemInfo("Java Version", "1.8.0_211"); }
     * 
     * @Before public void beforeScenario(Scenario scenario) {
     * Reporter.assignAuthor("Mohammad Shadab- ML14165"); }
     * 
     * @After(order = 0) public void AfterSteps() { Suitebase.closeWebBrowser(); }
     * 
     * @After(order = 1) public void afterScenario(Scenario scenario) { if
     * (scenario.isFailed()) { String screenshotName =
     * scenario.getName().replaceAll(" ", "_"); try { // This takes a screenshot
     * from the driver at save it to the specified location File sourcePath =
     * ((TakesScreenshot) Suitebase.driver).getScreenshotAs(OutputType.FILE);
     * 
     * // Building up the destination path for the screenshot to save // Also make
     * sure to create a folder 'screenshots' with in the cucumber-report // folder
     * File destinationPath = new File(System.getProperty("user.dir") +
     * "/target/cucumber-reports/screenshots/" + screenshotName + ".png");
     * 
     * // Copy taken screenshot from source location to destination location
     * Files.copy(sourcePath, destinationPath);
     * 
     * // This attach the specified screenshot to the test
     * Reporter.addScreenCaptureFromPath(destinationPath.toString()); } catch
     * (IOException e) { } } }
     */
}

I am getting this error

java.lang.AbstractMethodError: io.cucumber.testng.TestNGCucumberOptionsProvider$TestNGCucumberOptions.publish()Z


Read more here: https://stackoverflow.com/questions/67385913/java-lang-abstractmethoderror-io-cucumber-testng-testngcucumberoptionsprovider

Content Attribution

This content was originally published by user1004529 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: