O'Reilly logo

The Cucumber Book, 2nd Edition by Steve Tooke, Aslak Hellesoy, Matt Wynne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required