cucumber-jvm java HelloWorld示例OutOfBoundsException错误

时间:2013-03-21 16:21:24

标签: java cucumber bdd

我想帮助运行此程序包中的java cucumber'hello world'示例: 的 cucumber.examples.java.helloworld.HelloStepdefs

我想知道我的设置错过了什么吗?

我一直收到以下错误:

Feature: Hello World  Time elapsed: 0 sec  <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.RangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at gherkin.formatter.PrettyFormatter.indentedLocation(PrettyFormatter.java:142)
    at gherkin.formatter.PrettyFormatter.printStep(PrettyFormatter.java:255)
    at gherkin.formatter.PrettyFormatter.match(PrettyFormatter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cucumber.runtime.Utils$1.call(Utils.java:44)
    at cucumber.runtime.Timeout.timeout(Timeout.java:12)
    at cucumber.runtime.Utils.invoke(Utils.java:40)
    at cucumber.runtime.RuntimeOptions$2.invoke(RuntimeOptions.java:138)
    at $Proxy11.match(Unknown Source)
    at cucumber.runtime.junit.JUnitReporter.match(JUnitReporter.java:61)
    at cucumber.runtime.Runtime.runStep(Runtime.java:250)
    at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:49)
    at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:43)
    at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:36)
    at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:83)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:77)
    at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at cucumber.api.junit.Cucumber.run(Cucumber.java:82)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:113)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

2 个答案:

答案 0 :(得分:6)

即使我面临与1.1.3相同的问题:(只是看到这个https://groups.google.com/forum/?fromgroups=#!topic/cukes/rCVf28oK1SI它似乎是一个回归问题。我在pom中更改了版本并将文件构建到1.1.2并且它现在正常工作。

答案 1 :(得分:1)

只有在配置了格式化程序,删除它并且所有测试都正确运行时,才会出现此错误。

所以,删除格式化......和版本1.1.3有效,但你的所有输出都松散了吗?!