Cucumber School

1: Describe behaviour in plain text


2: Write a step definition in Ruby

Calculator Steps

3: Run and watch it fail

Failing output

4. Write code to make the step pass


5. Run again and see the step pass

Pending output

6. Repeat 2-5 until green like a cuke

Passing output

7. Repeat 1-6 until the money runs out

Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain-specific language and serves as documentation, automated tests and development-aid - all rolled into one format.

Cucumber works with Ruby, Java, .NET, Flex or web applications written in any language. It has been translated to over 40 spoken languages.

Cucumber also supports more succinct tests in tables - similar to what FIT does. Dig around in the examples and documentation to learn more about Cucumber tables.

Background and Credits

Cucumber is Aslak Hellesøy’s rewrite of RSpec’s “Story runner”, which was originally written by Dan North. (Which again was a rewrite of his first implementation - RBehave. RBehave was his Ruby port of JBehave). Early versions of the RSpec “Story Runner” required that stories be written in Ruby. Seeing how much this sucked David Chelimsky added plain text support with contributions from half a dozen other people.

In April 2008, Aslak Hellesøy started the Cucumber project to address the internal design flaws and usability problems of the RSpec Story Runner (Yes - Cucumber also has warts on the inside). Joseph Wilk and Ben Mabey joined as regular contributors when Cucumber was just a little Gherkin. Matt Wynne joined the Cucumber team in September 2009 after. Mike Sassak and Gregory Hnatiuk joined in October 2009 after their great work on a faster parser for Cucumber. In addition to the core team over 160 250 developers have contributed patches, bugfixes, tears and joy.

Cucumber's plain text DSL (Gherkin) somehow came out from the Agile community, mostly based on distillations made by Dan North, Chris Matts, Liz Keogh, David Chelimsky and dozens of people on the RSpec and Cucumber mailing lists. And me.

Half day tutorial at the EuroSTAR conference 25. Nov 2014.

2 Days BDD/Cucumber conference in NYC 30 Sep - 1 Oct.

Join our BDD/Cucumber training coming up in Berlin (22-25 Oct) and Atlanta, GA (5-7 Nov).

The Cucumber Book: Behaviour-Driven Development for Testers and Developers
The authoritative Cucumber guide. Written by core team member Matt Wynne and Cucumber creator Aslak Hellesøy.

Cucumber Recipes: Automate Anything with BDD Tools and Techniques
Forty practical recipes covering testing on desktop, web, mobile, and server applications across a variety of platforms.

Free Chapter from Specification by Example!

Pdf Word

Get 38% off using code cukes38sbe

London 3-4 April 2014

Agile Toolkit Podcast Bob Payne of the Agile Toolkit interviews Aslak Hellesøy.

Introduction to Outside-in Development with Cucumber - Carl Youngblood September 6, 2009 - Introduction to Outside-in Development with Cucumber - Carl Youngblood.

Ruby Classes via Cucumber  - Joseph Leddy & Leah Welty-Rieger from Obtiva July 24, 2009 - Ruby Classes via Cucumber by Joseph Leddy & Leah Welty-Rieger at Obtiva.

Outside In with Cucumber - Joseph Wilk at Scotland on Rails 2009 May 21, 2009 - Joseph Wilk from the Cucumber team presents Outside-In development with Cucumber at Scotland On Rails 2009.

More on Cucumber - Ryan Bates Railscasts Apr 27, 2009 - Ryan Bates from RailsCasts dives into tables, scenario outlines and tags.

Acceptance-Testing Ruby Web Apps - Bryan Liles Apr 01, 2009 - Bryan Liles gives an introduction to Cucumber, Webrat and Integrity.

Beginning with Cucumber - Ryan Bates Railscasts Mar 30, 2009 - Ryan Bates from RailsCasts demonstrates how to get started with Cucumber and Ruby on Rails.

Outside-In Development with Cucumber at MountainWest RubyConf Mar 14, 2009 - Ben Mabey presents at MountainWest RubyConf. Download the slides and follow along!

Discussion on Cucumber's Usefulness and Value Feb 04, 2009 - Jeff Dean talks about his experience with Cucumber at Pivotal Labs.

Cucumber and Watir Jan 18, 2009 - Dave Hoover demonstrates how to use Watir with Cucumber. Actually, he uses his own library SafariWatir, but you could easily swap it with Watir, FireWatir, ChromeWatir or Celerity. Sorry - no sound.

Podcast Cocoacast interview with Aslak Hellesøy - creator of Cucumber.

Aslak Hellesøy presented Cucumber at Øredev in Malmö on Friday 6th on November.

EuroSTAR 2009
Aslak Hellesøy presented Cucumber at the EuroSTAR conference in Stockholm on Thursday 3rd of December.

Aslak Hellesøy presented Cucumber and Cuke4Duke at RubyFoo in London.

RailsConf 2009
Aslak Hellesøy presented Cucumber at RailsConf in Las Vegas and got some good press.


You need Ruby installed. Then just run
gem install cucumber
from a command prompt. Now, run
cucumber --help

The wiki has more information.


A major contributory factor to the success of the BBC's digital Olympics was the use of Cucumber to collaboratively specify requirements, guide development, drive automated tests and describe the system.

—Aidy Lewis, Test Discipline Lead BBC Future Media - News and Knowledge

My attention-span is short so I may be forgetting something but I think Cucumber could be the most important piece of software released in 2008 for Ruby-based developers.

Dr Nic

If you’re looking for a higher level of abstraction in your tests, it’s definitely worth checking out.

Mike Gunderloy on Ruby Inside

I finally looked into cucumber last week and immediately loved it. Within a couple hours I had several features written for an existing application. By the end of the next day, our whole team was writing cucumber features, and enjoying it! Cucumber seems to have brought back an excitement to testing that I haven’t felt for a while (since my first few weeks with RSpec).

Brandon Keepers

Seeing what you guys are doing is just over-the-top cool. BDD is great, Domain Driven Design is great. Stuff I wish I knew 20 years ago.

Tim Walker

I started using Cucumber yesterday and it was really easy.

Craig Webster

Cucumber allows you to write feature documentation in Plain Text. It means you could sit with your Client or Business Analyst to write down the features to be build on your application.

Lakshan Perera’s Ruby Advent 2008

Cucumber is fast becoming the standard for acceptance testing in Rails. Cucumber is a BDD tool for specification of application features and user scenarios in plain text. It’s powered by Ruby, supports over 20 spoken languages, and integrates with other testing platforms.

Nick Quaranto – GitHub Featured project December 2008

God DAMN I want a BDD tool for Python that runs as well as cucumber 0.0003 or whatever it’s called does already. Dammit.

Bill Tozier

Continuous Integration Blueprints: How to Build an Army of Killer Robots With Hudson and Cucumber.

Robert Boyd