Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber step definition folder naming

Tags:

ruby

cucumber

I have just started using cucumber and am seeking clarification whether the folder having my step definitions must be named exactly as step_defnitions or can it be anything (e.g. my_defs). I tried renaming in my local machine but sometimes it works and sometimes doesn't.

features/
|
|-- step_definitions/ 
like image 872
RubyNoobie Avatar asked Nov 19 '25 05:11

RubyNoobie


1 Answers

Cucumber will automatically load any files within the features folder. This means that your step definition files can be located in any folder name/structure as long as they are in the features folder.

Note that it is possible to override this setting and explicitly state the location of your steps by doing:

cucumber -r your/steps/folder/location

For more details you can see the help - cucumber -h:

-r: Require files before executing the features. If this option is not specified, all *.rb files that are siblings or below the features will be loaded auto-matically. Automatic loading is disabled when this option is specified, and all loading becomes explicit. Files under directories named "support" are always loaded first. This option can be specified multiple times.

like image 90
Justin Ko Avatar answered Nov 21 '25 18:11

Justin Ko