Organize your Cucumber garden

Updated: 29 July 2011: now using lib directory

I’ve found it’s good to store all the pages and common code in a lib directory next to your features directory, so that when you do a dry-run, none of this code is loaded, which can cause problems.

You need to add the lib directory to your load path using something like:

$: << File.dirname(__FILE__)+'/../../lib'

A typical file structure (Cucumber garden) would look something like this:

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

8 thoughts on “Organize your Cucumber garden”

  1. Have you every tried to completely remove these from the features directory altogether and place these under a lib or testlib directory off of the root? If so, what was your experience?


  2. Actually, after reading my reply and digging through the project’s repository, I’m not sure what I meant. Sorry about that. After digging into the code I was better able to understand how it was running headless tests.


  3. How do you merge this with the prior post about organizing features into subdirectories with regard to where you put the steps? If you are grouping features into directories, do you still just have one steps folder below the main features directory, or are you putting feature specific steps into a step folder below the features subdirectory?

    did that make sense? Maybe that question would be better asked in the other posting?


    1. Steps must be below step_definitions, but organizing them into folders makes no difference so it’s a personal preference.


Comments are closed.