java.lang.NoSuchMethodError:cucumber.runtime.FeaturePathFeatureSupplier

时间:2019-05-21 02:14:13

标签: selenium selenium-webdriver

我是硒新手。     我想生成一个可扩展的报告。在jar文件下面。     https://ibb.co/6yJ3j56

I have tried a version of 
cucumber-core-1.2.5
cucumber-core-2.4.0
cucumber-core-4.2.6

Runner类的Java代码下面的链接显示了我有多少个jar文件   使用,请点击链接

Jar File链接链接:https://ibb.co/6yJ3j56

@RunWith(Cucumber.class)

@ExtendedCucumberOptions(jsonReport = "target/Json/cucumber.json",
                        retryCount = 3,
                    detailedReport = true,
                    detailedAggregatedReport = true,
                    overviewReport = true,
                    coverageReport = true,
jsonUsageReport = "target/Json/cucumber-usage.json" ,
usageReport = true,
toPDF=true,
includeCoverageTags= {"@chrome"},
outputFolder="target"
)


@CucumberOptions( strict= true,
        features="resources/features/DataDrivenLogin.feature", 
        glue="stepDefinitions",
        plugin= {"html:target/cucumber-html-report", 
                "json:target/Json/cucumber.json",
                "usage:target/Json/cucumber-usage.json",
                "junit:target/Json/cucumber-results.xml",
                "rerun:target/Json/rerun.txt",

    "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:/target/Report/report.html"
        }
        ,monochrome = true      

        )

Error: 


java.lang.NoSuchMethodError: cucumber.runtime.FeaturePathFeatureSupplier.<init>(Lcucumber/runtime/model/FeatureLoader;Lcucumber/runtime/RuntimeOptions;)V
    at cucumber.api.junit.Cucumber.<init>(Cucumber.java:88)
    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 org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:90)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:76)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)

1 个答案:

答案 0 :(得分:0)

如我所见-您正在使用不同的.jar版本:https://i.imgur.com/ZujATb0.png

打开项目的pom.xml并调整版本,例如

 <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.5</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>1.2.5</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.5</version>
        <scope>test</scope>
    </dependency>

应该可以解决问题。