Jump to ratings and reviews
Rate this book

The Cucumber Book: Behaviour-Driven Development for Testers and Developers

Rate this book
Your customers want rock-solid, bug-free software that does exactly what they expect it to do. Yet they can't always articulate their ideas clearly enough for you to turn them into code. The Cucumber Book dives straight into the core of the problem: communication between people. Cucumber saves the day; it's a testing, communication, and requirements tool - all rolled into one.

We'll show you how to express your customers' wild ideas as a set of clear, executable specifications that everyone on the team can read. You'll learn how to feed those examples into Cucumber and let it guide your development. You'll build just the right code to keep your customers happy, and not a line more.

The first part of the book teaches you how to use the core features of Cucumber. You'll learn how to use Cucumber's Gherkin DSL to describe-- in plain language - the behavior your customers want from the system. You'll learn how to write Ruby code that interprets those plain language specifications and checks them against your application. In Part 2, you'll consolidate the knowledge you just gained with a worked example.

Although it was born in the Ruby community, you can use Cucumber to test almost any system, from a simple shell script or a Perl script, to enterprise PHP or a Java web application. In Part 3, you'll find a selection of recipes for some of the most common situations you'll encounter using Cucumber in the wild. You'll learn how to test Ajax-heavy web applications with Capybara and Selenium, REST web services, Ruby on Rails applications, command-line applications, legacy applications and lots more!

Written by the creator of Cucumber and one of its most experienced users and contributors, The Cucumber Book is an authoritative guide that will give you and your team all the knowledge you need to start using Cucumber with confidence.

What You Need:

Windows, Mac OS X (with XCode) or Linux

Ruby 1.9.2 and upwards

315 pages, Paperback

First published January 1, 2011

72 people are currently reading
514 people want to read

About the author

Matt Wynne

3 books6 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
125 (26%)
4 stars
230 (48%)
3 stars
112 (23%)
2 stars
8 (1%)
1 star
1 (<1%)
Displaying 1 - 30 of 33 reviews
Profile Image for Brian.
44 reviews5 followers
March 31, 2013
I have used Cucumber professionally for about a year now. This book is what I read when I started out on my Cucumber journey. After a reread and some lessons learned, I think I'm in a place to write a useful review, hopefully.

Cucumber... we are talking about a better way to create software, a methodology: Behavior-Driven Development (BDD), a tool: Cucumber. BDD originated with Dan North to supplement Test-Driven Development (TDD). TDD is the idea that you create better software by writing tests first, before coding. BDD adds to that idea by saying you create better software by writing tests first, expressed in the language of the business, before coding. Cucumber is a tool to implement BDD.

Why would anyone be interested in Cucumber? What can it do for you? "Instead of the business stakeholder passing requirements to the development team without much opportunity for feedback, the developer and stakeholder collaborate to write automated tests that express the outcome that the stakeholder wants." Simply said: it helps to reduce miscommunication. The book often talks about how "a ubiquitous language can emerge that is used and understood by everyone involved." Cucumber uses natural language, the way we speak, to express the behavior of the system. This natural expression becomes executable specifications, or living documentation.

The book is part BDD and part Cucumber tutorial. By looking at the table of contents, it's clear the focus is on tutorial. If you want to learn Cucumber, this is the book for you. In fact there aren't many choices available. However, if you want to learn more about BDD, you might be disappointed and need to look elsewhere.

I appreciated the section--Chapter 13--on BDD and legacy applications, albeit a small section. Let's face it, legacy is where most of us live. In the brownfield we dance and dirty ourselves. The fear of breaking legacy code is real. We've all seen it cause developers to simply refuse to touch certain areas of the code. If your application lacks unit tests, it's easier and cheaper to build user acceptance tests first, testing your code from the outside. Cucumber can help you in this regard. The steps laid out in "Adding New Behavior"--section 13.3--lays out the typical process for working with Cucumber and legacy code.

I took off one star because I felt the authors should have talked about some disadvantages to using BDD. Even Dan North, where BDD began, talks about BDD's perils. Own it. There is good and bad in most technologies. BDD, and the use of Cucumber, comes at a cost. That cost may be too much for some teams. The first thing to consider is if the problem Cucumber is trying to solve is a problem you have: misunderstood requirements. And along the same thinking, do you already have tools that help solve this problem? Do you need all of them? Second, automated acceptance tests become one more thing you need to maintain. Are you going to ask your testers to maintain them? Do they have the desire and the aptitude? Third, it's fairly easy to create automated acceptance tests, but much harder to create good tests, tests that will scale and are easy to maintain. Make sure Cucumber is an investment worthy of your time.

It is worth noting that Cucumber is not the only tool to implement BDD: xBehave, RSpec, Fit, and FitNesse are some others.
Profile Image for Joe Wright.
15 reviews4 followers
March 23, 2013
This easy-reading book tells you all the tips you need to get going with Cucumber and BDD.

It starts off by framing the main problem Cucumber/BDD solves, that of creating an ubiquitous language. A very important point when you are considering whether Cucumber is the right tool for you. If you have problems with the business and IT talking a different language about the same product then you might want to consider adopting Cucumber, however, if you are a single coder with the idea in your head, there's not much point. It's refreshing to hear authors making this clear while promoting their work.

Highlights for me were the "what to do if you suffer from..." chapter recognising that things can go wrong when you apply a tool. This book also contains the best introduction to regexs I've ever read. That chapter made me want to go off and study regex more, rather than run 100 miles away at the first sight of one.

The book references other modern classics like Working with Legacy Code, RSpec and GOOS. Those books do a great job talking about testing and talking to stakeholders to drive understanding and code quality. I felt that the book should have a section on when it's appropriate to use different testing strategies, such as testing via the GUI, or via an API that the GUI talks to in oder to avoid the natural tendency to test via the UI.

If you are interested in BDD or are using Cucumber, you have to buy this book.

174 reviews4 followers
July 31, 2018
I really appreciated the clean execution of this book-

-Explain a simple concept
-Give a simple example
-Peel back what's underneath that example
-Explain how that behavior can be changed, overridden, customized, or just what the next feature supporting more complexity is

Only when it is needed:
-Introduce some Ruby code, without getting bogged down in details
-Introduce some Ruby gems/tools/frameworks. Give enough explanation about the new piece, but keep usage as simple as possible. They're selling Cucumber, not everything else.

And finally:
-Build from simple toys into examples that are still toys, but that illustrate how you can deal with real world needs
-Introduce some more background to illustrate general uses (RESTful web services vs. web apps vs. command line tools) and the different choices and approaches that matter.

I might love a .NET specific version of this book, but I never felt my time was wasted with examples specific to Ruby and Ruby-related-tools/frameworks.
Profile Image for Fábio Fortkamp.
176 reviews6 followers
August 25, 2025
I bought this book on a whim - I was passing through my local university bookshop when I saw "The Cucumber Book" was on sale. I think this perfectly embodies my experience with the book: a niche book about a niche tool used by a niche methodology, and yet it helped me precisely in the moment I was needing it.

As a postdoc, I develop simulation software, and as my research progresses, the tasks my programs must do also grow. For the 3 weeks or so in which I was reading this book along my daily programming tasks, I found it really helpful to think in terms of "features" that include "steps" that have to be "implemented" (and these terms in quotes are fundamental terms explained in the book). I'm still really slow in terms of following the Behaviour-Driven Development (BDD) cycle, and maybe it is overkill for the type of work I do; but reading "The Cucumber Book" has left a small print in my way of thinking about programming, and that makes it worth it.
Profile Image for Christoph Kappel.
477 reviews11 followers
September 17, 2022
I really enjoyed reading this book - it very well written and entertaining. I especially enjoyed the Joe panels and I identified more often than I'd like to admit with his questions.

Every chapter adds more pieces to a fictional ATM software example written in Ruby and explains how the new additions can be tested with cucumber in a BDD-y way.

I think this is a good starter, if you want to delve into the topic and Ruby knowledge isn't strictly required, since the code is really clear and concise.

If you are a Java developer I'd suggest to consider this version of the book: The Cucumber for Java Book: Behaviour-Driven Development for Testers and Developers
89 reviews2 followers
June 24, 2021
I've read as much of this as I'm going to.

The first part of the book covers gherkin, which I found useful as an additional source of info to that of the other BDD books I've read. It's a little out of date, as there's no mention of the new Rule: keyword, but is fine otherwise.

The rest of the book is more concerned with setting up the step definitions, which is more of the programmer end of the spectrum, and not something I'm currently that interested in.
Profile Image for Яўген.
42 reviews
November 8, 2018
The authors of the tool tell about it in an understandable way. Recommended for those who work with it. The only minus for me personally is the examples in Ruby. The third part of the book is quite technical by the way.
Profile Image for Ethan W.
41 reviews
April 19, 2022
Informative book, didn't finish because the last half is Ruby-specific, but the first part on philosophy is engaging and helpful if you want to know if cucumber is for you/best practices
Profile Image for John.
488 reviews412 followers
February 21, 2012
This is a very good book on Cucumber, and the examples use up-to-date supporting gems and APIs (Capybara; Aruba, etc.).

I learned some new things about Cucumber: E.g., Transformers (for providing a standard strategy for converting Regexp matches into object instances), and the fact that "given / when / then / etc." can be replaced with a single star for concision. So in matter of detail, this book was good.

On the other hand, the book stops with Cucumber; you don't get the "two circle" approach where you do what you can "outside-in" and then when you need to introduce a new class, you switch to RSpec. Given the high quality of the Cucumber discussion, I think this is really too bad. The RSpec book has all kinds of problems of exposition, but I think the authors here have the stuff to have written THE single Ruby testing book. To be sure, it would have become longer and would have taken them off their main topic, but it sure would have filled a gap.
Profile Image for Vergiliu.
18 reviews1 follower
January 4, 2015
The book even if it's targeted towards the Ruby crowd is as useful for the Ruby as well as for Ruby-derived frameworks, such as Lettuce for Python or Cucumber-java for well, you know...

The first ten or so chapters have a really nice progress of testing and at a same time drafting an application that is of course focussed on Cucumber. Lots of tips as well as ways of working and avoiding common pitfalls are presented throughout the chapters.

Also throughout the book you'll find not only useful Cucumber tailored techniques but also things which apply in a continuous integration environment. As the focus is also on the environment, you can find various Ruby frameworks which can be used for you daily tasks regarding the Cucumber framework. A couple worth mentioning are ActiveRecord (working with databases), HTTParty/Sinatra (RESTful services), Capybara (AJAX pages), Database cleaner (consistent state of DB)
Profile Image for Elizabeth.
143 reviews3 followers
Read
May 3, 2016
Cucumber and Ruby are very dependent on file structure and having exactly the right version of all the gems so that things are fully supported but not yet deprecated. There was a lot of "do it this way, trust me" without the ability to extrapolate to other projects. Setting up a whole bunch of files only to have a line or two of code in each may be best practice, but it's not mine. I'm not sure whether I'm more frustrated by the language or the book.
Profile Image for Tom.
50 reviews5 followers
April 7, 2019
The book is succinct yet comprehensive. Written by the creator of Cucumber, it starts with explaining why to use Cucumber, moves through the fundamentals, and then discusses a variety of usages of the tool, with plenty of useful examples throughout. I wish more books about a particular technology were written like this one.
5 reviews
March 12, 2014
First part is completely useful and a must-read. Second and third parts are explorations of how to do particular things in Ruby and I found them less useful, especially if you are already familiar with testing methodologies.

Pick it up if you want a way to tell people what your software does in their own language.
600 reviews11 followers
April 12, 2018
The book offers a good introduction into Cucumber. The examples will bring you up to speed to try it on your own. However, I would have preferred some more detailed examples and a recommendation when not to use it.

The second edition only updated the versions of the tools, but is more or less the same book.
Profile Image for Rich Dammkoehler.
45 reviews3 followers
May 4, 2013
Good book. A must read for the Cucumber consumer. While I don't wholly agree with the authors on everything it provides a great guide to Cucumber as a tool and the general use of BDD/ATDD tools. In particular, the 3 Amigo's process (Chapter 5) is a must read, this process is a life saver.
Profile Image for Bill Gathen.
34 reviews2 followers
November 16, 2012
I'd heard that the design philosophy of the "worked example" section was worth the price of admission, and I do admit I learned a great deal about how we might better test our code and keep those tests organized, but in the end it seemed lacking as an overall picture of application design.
Profile Image for Trevor Bramble.
47 reviews5 followers
August 27, 2013
Surprisingly thorough, plugged some holes in my understanding of testing Rails views. Lots of digressions (in my opinion) and too much Rails implementation code, which I might have forgiven if it wasn't low quality.
Profile Image for Dave.
429 reviews17 followers
September 1, 2012
Excellent and very up to date book on the Cucumber automated acceptance testing system.
Profile Image for David.
11 reviews2 followers
April 15, 2013
Great book with a lot more to it than just information on how to use Cucumber.
Profile Image for Steven Bauer.
45 reviews
July 31, 2013
I liked the idea of better documenting your test cases but don't really want to write them in Ruby. Looked at the groovy version but it didn't seem quite ready to be used.
Profile Image for Tim Dugan.
715 reviews4 followers
February 12, 2014
I don't think it covered all the cucumber functionality. I needed more for REST.

The organization was a little odd to me.

The explanations were okay but I wanted more examples and variations.
Profile Image for Anuja.
1 review
June 13, 2014
I was already familiar with most of the cucumber features and usage. I still found some new tricks and tips. Very good for beginners.
Profile Image for Vincent Bloise.
10 reviews
March 14, 2015
Very interesting introduction to the Cucumber tool and behavior driven development in general.
Profile Image for Derrick.
34 reviews
August 1, 2016
This book taches you a lot while also being easy to read, even fun!
Displaying 1 - 30 of 33 reviews

Can't find what you're looking for?

Get help and learn more about the design.