Reputation: 375
I would like to modify cucumber so that when a given feature is being executed (say "login.feature") I want only login_steps.rb to be loaded for the web steps. Other step files should not be loaded.
IMO this would be very useful to have the same steps but which differ in implementation work accordingly from the feature's name which is being executed.
Since I have almost a hundred scenarios and I would prefer if the steps were of high level steps this would make sense.
Any ideas?
Upvotes: 3
Views: 1823
Reputation: 7067
Here is sample code for you,
.feature file
Scenario: Some description of the scenario
Given [some context]
When [some event]
Then [outcome]
.rb (Step Definition in ruby)
Given /^[some context]$/ do
// code module
// code module
end
[some context]
comes in feature file. says,
Given [some context]
When [some context]
Then [some context]
And [some context]
will perform in same operation. i.e Given, When, Then and And are generic.
Upvotes: 0
Reputation: 1339
You may be able to achieve something like this using the Cellophane gem. It supports nested step definitions and you can turn off looking for shared steps. I'm not sure this will get you all the way to where you want to be, but I've found the developer to be very responsive if cellophane could be modified to get you what you're looking for.
Upvotes: 1