1

我已按照 [此链接][1] 中的步骤进行操作。

以下错误已修复。但我现在面临一个新错误。我试图解决它,但找不到合适的解决方案。请帮忙。

java.lang.NoSuchMethodError:cucumber.runtime.RuntimeOptions.getJunitOptions()Ljava/util/List;
  [1]: https://www.joecolantonio.com/2017/03/23/rest-test-tool-karate-api-testing/

New error:

    java.lang.NoClassDefFoundError: cucumber/runtime/junit/JUnitOptions
        at com.intuit.karate.junit4.Karate.<init>(Karate.java:38)
        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:29)
        at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21)
        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:26)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    Caused by: java.lang.ClassNotFoundException: cucumber.runtime.junit.JUnitOptions
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 18 more
4

1 回答 1

-1

请创建一个新的 Eclipse 工作区,然后重试。

编辑:

抱歉这个错误之前没有报过,所以应该是你的环境有基本问题。

  1. 尝试升级或删除 Eclipse Cucumber 插件
  2. mvn test安装Maven后尝试从命令行运行
  3. 重新安装或升级 Eclipse
  4. 尝试清除本地 Maven 存储库(尝试搜索有关如何执行此操作的信息)
于 2017-08-10T09:21:48.203 回答