Channels ▼

Developer's Reading List

, March 13, 2012 The best books to recently roll of the presses cover malware analysis, test automation, C#, and programming your home.
  • E-mail
  • Print

The Cucumber Book

Matt Wynne and Aslak Hellesoy
Pragmatic Bookshelf

Behavior-driven development (BDD) is enjoying something of a renaissance as more developers recognize its benefits. Its advantages include the ability to capture user requirements in a script (using a customized DSL) that can be executed later against the evolving software to validate it. BDD tests are often comprehensive UATs recorded as use cases. They rely on language similar to: "Given a situation in which A, B, and C are true, when X happens, then Y and Z should occur." These scripts are then gathered into scenarios that test the app’s functionality across multiple components.

Cucumber is one of several well-regarded BDD frameworks. It runs primarily on Ruby (but can be jimmied easily enough to work with projects in Java and other languages). It follows in the footsteps of easyb (which won the Jolt Award in 2009) RSpec, JBehave, and several others.

This book is an excellent introduction both to BDD and the Cucumber tool. It explains in a clear style how to capture the requirements, write the tests, run them, and manage them as the project rolls along. In addition, handling sometimes difficult testing situations (configuring databases and resetting them afterwards), REST interface testing, and, of course, web interfaces are all explained simply and straightforwardly by authors who have clearly spent a lot of time working through these problems.

My only hesitation is that the book does not describe mock objects. In fact, mocks do not appear at all in the index and stubs have one entry only. Yet the ability to run BDD scenarios on an incomplete project relies heavily on the ability to mock the missing pieces. The author dance around this by creating stubs (essentially skeleton objects), but without recognizing or exploring the deeper needs that this step implies.

Otherwise, though, an excellent book that is highly recommended. — A. Binstock

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.