Over a million developers have joined DZone.

Quick Review of The Cucumber Book from a SpecFlow Perspective

DZone's Guide to

Quick Review of The Cucumber Book from a SpecFlow Perspective

· DevOps Zone ·
Free Resource

Open source vulnerabilities are on the rise. Read here how to tackle them effectively.

Recently I finished reading a new book titled The Cucumber Book: Behaviour-Driven Development for Testers and Developers by Matt Wynne and Aslak Hellesoy. Aslak is the founder of the Cucumber project (which is what SpecFlow for .NET is based on), and Matt is one of its most active developers. The 328-page book is only 20 USD if you get it through The Pragmatic Bookshelf and worth the money, even if you're an experienced SpecFlow developer/tester. 


The code examples are written in Ruby, but even without any prior knowledge of Ruby, I managed to get through them quite easily. (Off-topic: It's not a language I see myself coding in anytime soon, so I must be a C-language addict). 

Anyway, the first 6 chapters (Part I) are awesome. Not only do they provide a decent introduction to the concepts behind Cucumber and a detailed break down of the Gherkin language, it also provides numerous tips and tricks that should prevent you from making your efforts gone bad. Just as you can go bad with practices like TDD, there's a whole lot you can do wrong when dealing with automation scenarios based on the Gherkin language. Even after reading the  Secret Ninja Cucumber Scrolls and everything there is to read on  SpecFlow, I learned some valuable new lessons that sure are going to improve the work I'm doing right now. 

Chapters 7-10 (Part II) are taking a deep-dive in implementing the Step Definitions using Ruby. Since I don't care about the Ruby details, I mostly browsed through these pages looking for hidden tips and tricks. If you are a .NET developer like me, I would do the same. But just make sure you read all the side-notes (the ones with a bluish background). They contain some valuable best practices. 

Again, if you're a .NET developers, you can skip chapters 11, 14 to 16 and the appendixes since they are too specific to the Cucumber tool and the Ruby language. But do try to read chapters 12 (Testing a REST Service) and 13 (Adding Tests to a Legacy Application).

You might wonder why I still believe the 20 dollars are worth the money after I told you to skip so much of the book's contents. It just that those first 100 pages plus the many best practices in the remainder of it really make up for the rest of the book. Since I'll be talking about SpecFlow and WaTiN at the Dutch .NET User Group meeting on  August 30st, I have been looking for some decent advice on writing proper Features and Scenarios for a while. The book delivered. Period. 
For completeness, here’s the table of the contents. 
  1. Why Cucumber?
  2. First Taste
  3. Gherkin Basics
  4. Step Definitions: From the Outside
  5. Expressive Scenarios
  6. When Cucumbers Go Bad
  7. Step Definitions: On the Inside
  8. Support Code
  9. Dealing with Message Queues and Asynchronous Components
  10. Databases
  11. The Cucumber Command-Line Interface
  12. Testing a REST Web Service
  13. Adding Tests to a Legacy Application
  14. Bootstrapping Rails
  15. Using Capybara to Test Ajax Web Applications
  16. Testing Command Line Applications with Aruba

Learn about the ins and outs of open source security and management.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}