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:
- IntelliJ is not detecting the Step Definition file written in Groovy, making any Run 'Feature' to return 'Undefined Step'
- 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
Please sign in to leave a comment.
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)
Hi Max,
Thank you for the response. Just need some clarification on your reply:
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--
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.
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
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.
Thank you! Worked like a charm! :D
You are welcome! I've created an issue for your case http://youtrack.jetbrains.com/issue/IDEA-109136