---
title: Cucumber Directory Convention
teaser:
tags: web,testing,ruby,rails
author: Dan Croak
published_on: 2009-08-17
---

I've been organizing Cucumber features in Rails apps using a strict directory
convention:

    features/admins/
    features/api_clients/
    features/users/
    features/visitors/

## The convention

*All features* go inside a directory named after a user type (including
non-human users such as <abbr title="Application Programming
Interface">API</abbr> clients).

* Visitors are un-authenticated users.
* Users are authenticated users.
* Use domain-specific language. If authenticated users are "editors", use
  features/editors instead of features/users.
* No features are at the top level.

## Why

I believe the single-most important attribute of a *well-written feature* is
that it clearly captures the mindset of an end user.

The convention keeps the vocabulary tight and enforces the concept that all
stories should be written by *walking a mile in the shoes* of some one or some
system.

![''](http://s3.amazonaws.com/thoughtbot-training/images/country_road.png)
