The Cucumber Book: BDD for Testers and Developers by Matt Wayne
04 Jan 2015The book, even if it’s targeted towards the Ruby crowd is useful for the other frameworks parsing Gherkin as well, such as Behave/Lettuce for Python or Concordion/Cucumber-JVM for well, you know… Java
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)
Below you can find some “might-be-useful” ideas from the book:
- Tags can be used to execute just certain scenarios
- Different formatters for the output, i.e.
-f rerun
to easily try out failing steps - Tagged hooks in order to run certain scenarios only on tagged steps
- we can store various profiles in the cucumber.yml file so we run different features/suites depending on situation
- also more output options to display a HTML report
- @wip tag for the features being actively developed
- when working with existing systems:
- start somewhere with a simple scenario, implement a bug report as a scenario
- Approaches on handling various situation: databases, async calls, web applications
- Introducing Cucumber to Rails, and trying to create a simple test feature for the Rails app
- Using Capybara to test an AJAX Rails app
- Capybara has a built-in headless driver than can be used with pages without JS code
- using an after hook and save a screenshot if the test fails
- Aruba is a framework designed to test CLI apps; @announce tags can be used for extra logging
- Other platforms: JS cucumber-js, Java cucumber-jvm, C# SpecFlow
- Gherkin language is one component, if one wants to implement a Cucumber-compatible framework
- Cucumber wire protocol is the other component, and it’s well documented so it should be fairly easy to implement drivers
- Ruby specific: bundler - a sort of Ruby package manager with auto-dependency,
As usual, you can find the book on Amazon or Goodreads, if you’re looking for more information or a place to grab a copy.