1: Describe behaviour in plain text
2: Write a step definition in Ruby
3: Run and watch it fail
4. Write code to make the step pass
5. Run again and see the step pass
6. Repeat 2-5 until green like a cuke
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!
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.
Aslak Hellesøy will present Cucumber at the EuroSTAR conference
in Stockholm on Thursday 3rd of December.
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.
Aslak Hellesøy presented Cucumber at RailsConf in Las Vegas and got some good press.
September 6, 2009 - Introduction to Outside-in Development with Cucumber - Carl Youngblood.
July 24, 2009 - Ruby Classes via Cucumber by Joseph Leddy & Leah Welty-Rieger at Obtiva.
May 21, 2009 - Joseph Wilk from the Cucumber team presents Outside-In development with Cucumber at Scotland On Rails 2009.
Apr 27, 2009 - Ryan Bates from RailsCasts dives into tables, scenario outlines
and tags.
Apr 01, 2009 - Bryan Liles gives an introduction to Cucumber, Webrat and Integrity.
Mar 30, 2009 - Ryan Bates from RailsCasts demonstrates
how to get started with Cucumber and Ruby on Rails.
Mar 14, 2009 - Ben Mabey presents at MountainWest RubyConf. Download the slides and follow along!
Feb 04, 2009 - Jeff Dean talks about his experience with Cucumber at
Pivotal Labs.
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.
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.
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).
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.
I started using Cucumber yesterday and it was really easy.
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.
Continuous Integration Blueprints: How to Build an Army of Killer Robots With Hudson and Cucumber.