Using Cucumber with Grails 2.2 in IntelliJ 12.1 Ultimate Edition

Hi All,
I'm trying to use Cucumber with Grails in IntelliJ 12.1. I've created both the feature file and the step definition files. However:

  1. IntelliJ is not detecting the Step Definition file written in Groovy, making any Run 'Feature' to return 'Undefined Step'
  2. Therefore, I can't run the Scenario either.

I'm attaching screenshots of a sample project I'm using to test this. Any pointers or help is really appreciated. Thanks!



Attachment(s):
folderStructure.PNG
GroovyStepDefFile.PNG
dotFeatureFile.PNG
7 comments

Hi,

it seems that you haven't got a cucumber groovy library in your project or a *StepDef.groovy contains incorrect refs to 'Hooks' and 'En' classes in the following statements:

this.metaclass.mixin(cucumber.runtime.groovy.Hooks)
this.metaclass.mixin(cucumber.runtime.groovy.En)

0

Hi Max,
Thank you for the response. Just need some clarification on your reply:

  1. If I'm missing the Cucumber groovy library, how do I add it?
  2. If I'm using the incorrect refs to the 'Hooks' and 'EN' classes how do I correct them?
  3. How can I confirm which one i causing the problem?


I've actually added to the Grails project the Cucumber-grails plugin (http://grails.org/plugin/cucumber). So, I'm guessing I'm missing something specific to IntelliJ IDEA -- but I could guess it wrong though, done that before! :p

--suhaizal--

0

Try to open CucumberException class using Ctrl+N to make sure thar cucumber-groovy library is added to the project.
If cucumber-groovy is missing try to run Synchronize Grails Settings action.

0

The Ctrl-N gives me the CucumberException reference (refer to attached image). So I think its added. Any other pointers? Thanks.

--suhaizal--



Attachment(s):
ctrln.png
0

Replace these two lines:

this.metaClass.mixin(cucumber.runtime.groovy.Hooks)
this.metaClass.mixin(cucumber.runtime.groovy.EN)

with

this.metaClass.mixin(cucumber.api.groovy.Hooks)
this.metaClass.mixin(cucumber.api.groovy.EN)

It will fix incorrect references to Hooks and EN classes.


0

Please sign in to leave a comment.