黄瓜测试结果与CucumberException:无法实例化公共

时间:2016-07-26 02:07:04

标签: junit cucumber

我收到此错误:

cucumber.runtime.CucumberException: Failed to instantiate public
cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader)
with [cucumber.runtime.io.MultiLoader@7006c658]     at
cucumber.runtime.Reflections.newInstance(Reflections.java:44)   at
cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:30)
    at cucumber.runtime.Runtime.loadBackends(Runtime.java:98)   at
cucumber.runtime.Runtime.<init>(Runtime.java:65)    at
cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:78)     at
cucumber.api.junit.Cucumber.<init>(Cucumber.java:58)    at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)     at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)     at java.lang.reflect.Constructor.newInstance(Unknown Source)
    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)

以下是我在构建路径中的jar:

cucumber core 1.2.4  
cucumber java 1.1.3  
cucumber junit 1.2.4 
cucumber jvm deps 1.0.5  
cucumber html 0.2.2  
cucumber reporting 2.2.0
gherkin 2.12.2  
selenium java 2.53.0  
selenium server  
standalone > 2.53.1

1 个答案:

答案 0 :(得分:0)

看起来有些依赖项不匹配。通常,您需要在Java中运行Cucumber:

  • cucmber-junit
  • cucumber-java
  • junit

我看到您的列表中已有cucumber-html。尝试删除它,看看是否有帮助。另外,请确保您没有其他可以删除的不需要的依赖项。