Reputation: 975
I have this step implementation
Given /^entity URI "([^"]*)"$/ do |arg1| @entityUri = arg1 end
I copied this step from an existing feature file to a new feature file
Given entity URI <Entity Resource URI>
Cucumber states 1 scenario (1 undefined) 8 steps (2 skipped, 4 undefined, 2 passed) 0m0.009s
You can implement step definitions for undefined steps with these snippets:
Given /^entity URI "(.*?)"$/ do |arg1| pending # express the regexp above with the code you wish you had end
P.S: I checked the directory structure of my old and new feature files and they are at the same level. Even this solution did not work for me: Cucumber: undefined step, although step should be defined
Upvotes: 2
Views: 3318
Reputation: 11
Check with the folder structure it should be like below
Create project folder
>Create features folder
>Create step definitions folder
>Save .rb files here
>Save .feature files here.
Step definition folder and .feature files should be in the feature file.
Even i faced the same issue like you.The folder structure solved my problem.
Upvotes: 0
Reputation: 11494
Based on the step matcher regex, I'd expect the step to match with double-quotes around the step:
Given entity URI "<Entity Resource URI>"
Upvotes: 3