You can test just about anything with Cucumber. We certainly have, and in Cucumber Recipes we’ll show you how to apply our hard-won field experience to your own projects. Once you’ve mastered the basics, this book will show you how to get the most out of Cucumber—from specific situations to advanced test-writing advice. With over forty practical recipes, you’ll test desktop, web, mobile, and server applications across a variety of platforms. This book gives you tools that you can use today to automate any system that you encounter, and do it well.
About this Book
- 272 pages
- Release: P2.0 (2014-03-26)
- ISBN: 978-1-93778-501-7
The Cucumber Book showed you how your team can work together to write executable specifications—documents that tell a clear story and also happen to be working test code. We’ll arm you with ready-rolled solutions to real-world problems: your tests will run faster, read more clearly, and work in any environment.
Our first tips will help you fit Cucumber into your workflow. Powerful filters will tame tables full of test data, transforming them into the format your application needs. Custom output formatters will generate reports for any occasion. Continuous Integration servers will run your Cucumber tests every time the code changes. Next, you’ll find recipes tailored to the platform you’re running on. Ever wanted to know how to test a Grails app from Cucumber? Need to put a Windows program through its paces? How about a mobile app running on Android or iOS? We’ll show you how to do all of these.
Throughout the book, you’ll see how to make Cucumber sing as you interoperate with different platforms, languages, and environments. From embedded circuits to Python and PHP web apps, Cucumber has something for you.
What You Need:
You’ll need basic working knowledge of Cucumber and Ruby. Individual recipes may have additional requirements; for example, a recipe on Windows automation might pull in an open source GUI driver.
We’ve written the recipes for compatibility with Ruby 1.9.3 and 1.8.7, plus Cucumber 1.1.4. Other versions may work as well, but these are the ones we test with.
Contents and Extracts
- Cucumber Techniques
- Compare and Transform Tables of Data
- Generate an RTF Report With a Custom Formatter
- Run Slow Setup/Teardown Code With Global Hooks excerpt
- Refactor to Extract Your Own Application Driver DSL
- Compare Images
- Test Across Multiple Cores
- Test Across Multiple Machines With SSH
- Run Your Features Automatically With Guard and Growl
- Add Cucumber To Your Continuous Integration Server
- Publish Your Documentation on Relish
- Drive Cucumber’s Wire Protocol
- Implement a Wire Protocol Listener
- Use Cucumber Directly With JRuby
- Use Cucumber With Java Via Cucumber-JVM excerpt
- Drive a Spring Model
- Drive Hibernate Persistence
- Drive a Grails App
- Test Scala Code
- Test Clojure Code
- Drive a Swing Interface With Marathon
- .NET and Windows
- Get Good Text Output On Windows
- Test .NET Code Using Cucumber Syntax
- Drive a Windows App Using win_gui
- Drive a Windows App Using White
- Mobile and Web
- Test On iOS Using Frank
- Test On Android
- Test Across Multiple Mobile OSes With Calabash
- Test On Windows Phone
- Parse HTML Tables excerpt
- Test a Web App Using Watir
- Test a PHP App With cuke4php
- Play Back Canned Network Data Using VCR
- Drive a Flash App Using Cuke4AS3
- Monitor a Web Service Using Nagios and Cucumber
- Other Languages and Platforms
- Drive a Mac GUI Using AppleScript and System Events
- Drive a Mac GUI Using MacRuby and AXElements
- Test Python Code Using Lettuce
- Test Erlang Code
- Test Lua Code Using cucumber-lua
- Test a GUI on Linux, Mac, or Windows With Sikuli
- Test an Arduino Project Using Serial
- RSpec Tutorial
Comments and Reviews
—Dan North, Originator of BDD and author of the RSpec story runner
With Cucumber Recipes you feel like the authors are right there with you, offering you advice, showing you hidden gems, or gently chastising you for things you know you shouldn’t be doing. From general advice about taming unruly test suites or scaling out across multiple servers, to craziness like testing embedded Arduino hardware projects, they manage to cover an enormous amount of ground in a small space. Prepare for a fun and informative ride.
—Michael Larsen, Senior quality assurance engineer SocialText
There are many cookbooks but very few “chef books.” Cucumber Recipes is inspiring enough to qualify as a chef book. If there’s a will and a desire to use Cucumber in the process, Cucumber Recipes will more than likely show you a way…or many ways! From the basic to the esoteric, there’s something for everyone in Cucumber Recipes.
—Gáspár Nagy, Developer coach at TechTalk, creator of SpecFlow
It is good to see that a free tool like Cucumber has been able to build up a community that treats BDD as its own child and carries it to nearly every possible platform and technology. This book provides a closer look at the details.
—Lisa Crispin, Co-author, Agile Testing: A Practical Guide for Testers and Agile Teams
If you’re automating tests of any kind using Cucumber, in any language, against any type of software, you need this cookbook. Its recipes will help you write useful, easily maintained tests for even the most puzzling scenarios. Like all good cookbooks, it teaches good techniques and principles that will help you improve all your tests. Best of all, you can actually code the examples yourself, and learn by doing.
—Kavitha Naveen, Senior lead - quality engineering
Cucumber Recipes has testing solutions for a variety of platforms. It is a powerful book that gives us useful tips to use BDD in our chosen environment. To realize the power of BDD, Cucumber Recipes is a must on every software test engineer’s table.