cucumber/cucumber-jvm — Issue #122: tests with package named "groovy" will fail
Author: mpasch
Created: 2011-12-31 11:47:53+00:00
State: open

Hello,

I tried out cucumber-jvm with groovy and got stuck with a very weird problem. Since I tried java first I named my package "groovy" this actually caused cucumber-jvm to fail with an error, that didn't help me at all.
As I wouldn't consider this problem criticially (just rename the package...), It's probably not worth the time, but I'd like to have it documented, so the next one googleing their problem is more successful.

Steps to reproduce the problem:

- checkout cucumber-jvm
- cd into cucumber-jvm/examples/groovy-calculator
- run mvn test -> it'll work

- change package of DivisionTest from "calc" to "groovy"
- change folder name of src/test/resources/calc to "groovy"

- run mvn clean test -> it'll fail. (see stacktrace at the end of this comment)

Just to prove that I didn't make a mistake:
- change everything from "groovy" to "groovy2" and run "mvn clean test" again -> it'll work

$cat /home/mpasch/cucumber-jvm/git/cucumber-jvm/examples/groovy-calculator/target/surefire-reports/groovy.DivisionTest.txt
-------------------------------------------------------------------------------
Test set: groovy.DivisionTest
-------------------------------------------------------------------------------
Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 0.86 sec <<< FAILURE!
Scenario: Regular numbers Time elapsed: 0 sec <<< ERROR!
cucumber.runtime.CucumberException: Failed to scan jar
at cucumber.resources.Resources.scanJar(Resources.java:140)
at cucumber.resources.Resources.scan(Resources.java:58)
at cucumber.runtime.groovy.GroovyBackend.buildWorld(GroovyBackend.java:40)
at cucumber.runtime.Runtime.buildBackendWorlds(Runtime.java:124)
at cucumber.runtime.World.buildBackendWorldsAndRunBeforeHooks(World.java:34)
at cucumber.runtime.model.CucumberScenario.buildWorldAndRunBeforeHooks(CucumberScenario.java:30)
at cucumber.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:51)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.Cucumber.run(Cucumber.java:111)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: groovy.lang.MissingMethodException: No signature of method: groovy.inspect.swingui.AstBrowserProperties.org() is applicable for argument types: (groovy.inspect.swingui.AstBrowserProperties$_run_closure1) values: [groovy.inspect.swingui.AstBrowserProperties$_run_closure1@4b4c28db]
Possible solutions: run(), run(), grep(), any(), use([Ljava.lang.Object;), is(java.lang.Object)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at groovy.inspect.swingui.AstBrowserProperties.run(AstBrowserProperties.groovy:20)
at cucumber.runtime.groovy.GroovyBackend$1.consume(GroovyBackend.java:45)
at cucumber.resources.Resources.scanJar(Resources.java:136)
... 25 more

Scenario: Regular numbers Time elapsed: 0.007 sec <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:571)
at java.util.ArrayList.remove(ArrayList.java:412)
at cucumber.junit.JUnitReporter.match(JUnitReporter.java:30)
at cucumber.runtime.World.runStep(World.java:86)
at cucumber.runtime.model.CucumberScenario.runStep(CucumberScenario.java:72)
at cucumber.junit.ExecutionUnitRunner.runChild(ExecutionUnitRunner.java:78)
at cucumber.junit.ExecutionUnitRunner.runChild(ExecutionUnitRunner.java:18)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:68)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.Cucumber.run(Cucumber.java:111)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

Scenario: More numbers Time elapsed: 0.253 sec <<< ERROR!
cucumber.runtime.CucumberException: Failed to scan jar
at cucumber.resources.Resources.scanJar(Resources.java:140)
at cucumber.resources.Resources.scan(Resources.java:58)
at cucumber.runtime.groovy.GroovyBackend.buildWorld(GroovyBackend.java:40)
at cucumber.runtime.Runtime.buildBackendWorlds(Runtime.java:124)
at cucumber.runtime.World.buildBackendWorldsAndRunBeforeHooks(World.java:34)
at cucumber.runtime.model.CucumberScenario.buildWorldAndRunBeforeHooks(CucumberScenario.java:30)
at cucumber.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:51)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.Cucumber.run(Cucumber.java:111)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: groovy.lang.MissingMethodException: No signature of method: groovy.inspect.swingui.AstBrowserProperties.org() is applicable for argument types: (groovy.inspect.swingui.AstBrowserProperties$_run_closure1) values: [groovy.inspect.swingui.AstBrowserProperties$_run_closure1@2031688f]
Possible solutions: run(), run(), grep(), any(), use([Ljava.lang.Object;), is(java.lang.Object)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at groovy.inspect.swingui.AstBrowserProperties.run(AstBrowserProperties.groovy:20)
at cucumber.runtime.groovy.GroovyBackend$1.consume(GroovyBackend.java:45)
at cucumber.resources.Resources.scanJar(Resources.java:136)
... 25 more

Scenario: More numbers Time elapsed: 0.258 sec <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:571)
at java.util.ArrayList.remove(ArrayList.java:412)
at cucumber.junit.JUnitReporter.match(JUnitReporter.java:30)
at cucumber.runtime.World.runStep(World.java:86)
at cucumber.runtime.model.CucumberScenario.runStep(CucumberScenario.java:72)
at cucumber.junit.ExecutionUnitRunner.runChild(ExecutionUnitRunner.java:78)
at cucumber.junit.ExecutionUnitRunner.runChild(ExecutionUnitRunner.java:18)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:68)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at cucumber.junit.Cucumber.run(Cucumber.java:111)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)