【问题标题】:Karate Cucumber Runner throws "No Such Method"空手道黄瓜赛跑者抛出“没有这样的方法”
【发布时间】:2018-12-10 16:11:39
【问题描述】:

升级 Cucumber 和 Karate 版本后,我遇到了异常。

java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.cucumberFeatures(Lcucumber/runtime/io/ResourceLoader;)Ljava/util/List; 在 com.intuit.karate.cucumber.CucumberRunner.(CucumberRunner.java:70) 在 com.intuit.karate.testng.KarateRunner.setUpClass(KarateRunner.java:32) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.lang.reflect.Method.invoke(Method.java:498) 在 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) 在 org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59) 在 org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458) 在 org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222) 在 org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142) 在 org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:168) 在 org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105) 在 org.testng.TestRunner.privateRun(TestRunner.java:648) 在 org.testng.TestRunner.run(TestRunner.java:505) 在 org.testng.SuiteRunner.runTest(SuiteRunner.java:455) 在 org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) 在 org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) 在 org.testng.SuiteRunner.run(SuiteRunner.java:364) 在 org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 在 org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) 在 org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) 在 org.testng.TestNG.runSuitesLocally(TestNG.java:1137) 在 org.testng.TestNG.runSuites(TestNG.java:1049) 在 org.testng.TestNG.run(TestNG.java:1017) 在 org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) 在 org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236) 在 org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)

这是我的启动器/运行器:

@CucumberOptions(features = "features/PatientMS.feature", plugin = { "pretty", "html:target/cucumber-report/jsonfiles", "json:target/cucumber-report/jsonfiles/PatientMS.json" })
public class PatientMSLauncher extends KarateRunner {

}

空手道和黄瓜依赖关系:

<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>3.0.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>3.0.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-jvm</artifactId>
            <version>3.0.1</version>
            <type>pom</type>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-apache -->
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-apache</artifactId>
            <version>0.7.0.2</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-core -->
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-core</artifactId>
            <version>0.7.0.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-testng -->
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-testng</artifactId>
            <version>0.7.0.2</version>
        </dependency>

我尝试通过 JUnit 运行,但没有成功!| 我该如何处理这个问题?

谢谢:)

【问题讨论】:

  • 你需要在你的testrunner calss中添加glue属性
  • 我认为它必须在没有胶水属性的情况下工作,彼得做得非常好,并且涵盖了空手道的大部分 REST 方法。如果我们有没有额外定义的纯空手道项目,胶水将毫无用处。

标签: cucumber karate


【解决方案1】:

看起来您在 pom.xml 中混合了空手道和可能的 Cucumber 3 - 这是不受支持的。

如果还是卡住,请走这个流程:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

【讨论】:

  • 嗨彼得,感谢您的回复,我如何找到空手道支持的黄瓜版本?以防我们需要检查兼容性。
  • Karate 带来了修改后的 Cucumber 版本。团队通常只使用空手道依赖项,没有别的。如果您向pom.xml 添加更多内容,则只能靠自己。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-02
相关资源
最近更新 更多