1: Describe behaviour in plain text

Feature

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

Feature

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 30 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”). Early versions of “Story runner” required that stories be written in Ruby. Shortly after, 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 usability problems of the RSpec Story Runner. 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 over 160 developers have contributed patches and bugfixes.

The meta-language that Cucumber uses is based on several conversations and blog posts by Dan North, Chris Matts, Liz Keogh, David Chelimsky and dozens of people on the RSpec mailing list.

We want swag!

Click here to lend your support to: cucumber and make a donation at www.pledgie.com !

The money raised for this campaign will be spent to produce Cucumber swag to promote Cucumber: T-shirts, cups and other things.

The swag will be given away at conferences, and if enough money is raised, swag will also be sent to people who have contributed to Cucumber, including donors.

Learn more!


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

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

The RSpec Book: Behaviour Driven Development with RSpec, Cucumber and Friends The RSpec book has several chapters dedicated to Cucumber.


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


Aslak Hellesøy and Dean Wampler presented Cucumber on the JVM at Agile 2009 in Chicago.

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

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.

Download

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

The wiki has more information.

Testimonials

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

We are currently rolling out Cucumber to all projects within BBC Worldwide. We use it with great success in combination with Watir and Firewatir to automate our web acceptance tests. The natural language format is a great communication facilitator between all stakeholders.

—Aidy Lewis

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