Tim Riley

De-@wip Your Cucumber Stories

June 29, 2009

We’ve been really hitting the Cucumber hard in the recent few iterations of our current project. Now that we’re ping pong pair programming, the Cucumber story is the first thing we write, and we revisit regularly during the red-green-refactor cycle.

To make this easy, we place a @wip work in progress tag at the top of the current stories:

Feature: Make coffee

  # This one is done.
  Scenario: First coffee of the day
  
  # This is the one we're working on.
  @wip
  Scenario: Afternoon perk up

Then we use cucumber -t wip to run just the stories in progress. Once the stories are green and we’re happy to move on, we often forget to remove the @wip tags before committing. I wrote a little sed command in a bash alias to make this easier:

# Remove any @wip tags from Cucumber features.
alias dewip="sed -E -i '' -e '/^[[:blank:]]*@wip$/d;s/,[[:blank:]]*@wip//g;s/@wip,[[:blank:]]*//g' features/**/*.feature"

Throw it in your .bash_profile for ease of access! Here’s a gist for your forking pleasure.

Tim Riley

I'm Tim Riley, a web and iOS developer and a director at Icelab. I'm an Aussie living in the Philippines. This is my blog, where can I share with you the things that I learn between the morning coffee and the day's final git push.

What I Build