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.

Upcoming events

BDD Analysis, London

With Matt Wynne and George Dinwiddie

November 4th - 5th. ustwo offices, London

Executable Specifications with Discovery Workshops and Example Mapping.

BDD Analysis is a 2-day training in the analysis and collaboration aspects of Behaviour-Driven Development (BDD). It is a non-technical training for BAs, POs, developers and testers who want to learn how to create better executable specifications and living documentation.

If your organisation is only using Cucumber for test automation, this training will equip you with the skills you need to start using it for executable specifications and living documentation as well.

Book nowLearn more

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 2000 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 Aslak.


“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.”

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

“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.BDDis 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.”

“Cucumber is fast becoming the standard for acceptance testing in Rails. Cucumber is aBDDtool 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.”

“GodDAMN Iwant aBDDtool 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.”


The Cucumber for Java book

The Cucumber for Java Book has the same great advice about how to deliver rock-solid applications collaboratively, but with all code completely rewritten in Java. New chapters cover features unique to the Java version of Cucumber, and reflect insights from the Cucumber team since the original book was published.

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.