Specifying the Location of Step Definitions
Have you ever wondered how Cucumber finds your step definitions? There is nothing in Cucumber that expects them to be under features/step_definitions. In fact, if you renamed these two directories to jolly/jumper and ran cucumber jolly, things would work just as well.
Cucumber recursively scans some directories for .rb files to load, and if there are step definitions in them (or hooks or transforms), they get loaded. It’s important to understand what directories Cucumber scans. Once you understand this, you will save yourself from a common source of confusion and frustration. Let’s illustrate that with an example. Assume you have organized your features and step definitions as follows:
| | features ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access