Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Cucumber step definitions load according to feature file being executed

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?

like image 278
user Avatar asked Jan 01 '26 07:01

user


1 Answers

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.

like image 188
John Avatar answered Jan 04 '26 04:01

John



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!