3

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?

3 Answers 3

1

Currently, the only way to accomplish this (short of patching cucumber itself) is to put each feature into a separate directory tree with its own env.rb file and step_definitions directory.

See this post on the mailing list for more details.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

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 
  • This step definition will execute whenever [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.


Also, you can read behat document for better understanding - http://behat.readthedocs.org/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.