Quick Review of The Cucumber Book from a SpecFlow Perspective
Join the DZone community and get the full member experience.Join For Free
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.
- Why Cucumber?
- First Taste
- Gherkin Basics
- Step Definitions: From the Outside
- Expressive Scenarios
- When Cucumbers Go Bad
- Step Definitions: On the Inside
- Support Code
- Dealing with Message Queues and Asynchronous Components
- The Cucumber Command-Line Interface
- Testing a REST Web Service
- Adding Tests to a Legacy Application
- Bootstrapping Rails
- Using Capybara to Test Ajax Web Applications
- Testing Command Line Applications with Aruba
Published at DZone with permission of Dennis Doomen, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.