The Cucumber Book, 2nd Edition

Book description

Your customers want rock-solid, bug-free software that does exactly what they expect it to do. Yet they can't always articulate their ideas clearly enough for you to turn them into code. You need Cucumber: a testing, communication, and requirements tool-all rolled into one. All the code in this book is updated for Cucumber 2.4, Rails 5, and RSpec 3.5.

Publisher resources

View/Submit Errata

Table of contents

  1.  Foreword
  2.  Acknowledgments
  3.  Preface
    1. Who This Book Is For
    2. Why You Should Listen to Us
    3. How This Book Is Organized
    4. What Is Not in This Book
    5. Running the Code Examples
    6. Getting Help
  4. Part I. Cucumber Fundamentals
    1. 1. Why Cucumber?
      1. Automated Acceptance Tests
      2. Behaviour-Driven Development
      3. Living Documentation
      4. How Cucumber Works
      5. What We Just Learned
    2. 2. First Taste
      1. Understanding Our Goal
      2. Creating a Feature
      3. Creating Step Definitions
      4. Implementing Our First Step Definition
      5. Running Our Program
      6. Changing Formatters
      7. Adding an Assertion
      8. Making It Pass
      9. What We Just Learned
    3. 3. Gherkin Basics
      1. What’s Gherkin For?
      2. Format and Syntax
      3. Feature
      4. Scenario
      5. Comments
      6. Spoken Languages
      7. What We Just Learned
    4. 4. Step Definitions: From the Outside
      1. Steps and Step Definitions
      2. Capturing Arguments
      3. Multiple Captures
      4. Flexibility
      5. Returning Results
      6. What We Just Learned
    5. 5. Expressive Scenarios
      1. Background
      2. Data Tables
      3. Scenario Outline
      4. Nesting Steps
      5. Doc Strings
      6. Staying Organized with Tags and Subfolders
      7. What We Just Learned
    6. 6. When Cucumbers Go Bad
      1. Feeling the Pain
      2. Working Together
      3. Caring for Your Tests
      4. Stop the Line and Defect Prevention
      5. What We Just Learned
  5. Part II. A Worked Example
    1. 7. Step Definitions: On the Inside
      1. Sketching Out the Domain Model
      2. Removing Duplication with Transforms
      3. Adding Custom Helper Methods to the World
      4. Organizing the Code
      5. What We Just Learned
    2. 8. Support Code
      1. Fixing the Bug
      2. Bootstrapping the User Interface
      3. Making the Switch
      4. Using Hooks
      5. Building the User Interface
      6. What We Just Learned
    3. 9. Dealing with Message Queues and Asynchronous Components
      1. Our New Asynchronous Architecture
      2. How to Synchronize
      3. Implementing the New Architecture
      4. Fixing the Flickering Scenario
      5. What We Just Learned
    4. 10. Databases
      1. Introducing ActiveRecord
      2. Refactoring to Use a Database
      3. Reading and Writing to the Database
      4. Cleaning the Database with Transactions
      5. Cleaning the Database with Truncation
      6. What We Just Learned
  6. Part III. Cucumber Applied
    1. 11. The Cucumber Command-Line Interface
      1. Cucumber’s Command-Line Options
      2. Running a Subset of Scenarios
      3. Changing Cucumber’s Output
      4. Specifying the Location of Step Definitions
      5. Managing Your Work in Progress (WIP)
      6. Using Profiles
      7. Running Cucumber from Rake
      8. Running Cucumber in Continuous Integration
      9. What We Just Learned
    2. 12. Testing a REST Web Service
      1. In-Process Testing of Rack-Based REST APIs
      2. Out-of-Process Testing of Any REST API
      3. What We Just Learned
    3. 13. Adding Tests to a Legacy Application
      1. Characterization Tests
      2. Squashing Bugs
      3. Adding New Behavior
      4. Code Coverage
      5. What We Just Learned
    4. 14. Bootstrapping Rails
      1. Running the Generators
      2. Creating a User
      3. Posting a Message
      4. Associating a Message with a User
      5. Creating a Controller by Hand
      6. Implementing the View
      7. What We Just Learned
    5. 15. Using Capybara to Test Ajax Web Applications
      1. Implementing a Simple Search Without Ajax
      2. Searching with Ajax
      3. The Capybara API
      4. Taking Screenshots
      5. What We Just Learned
    6. 16. Testing Command-Line Applications with Aruba
      1. Simple Interfaces
      2. Our First Aruba Feature
      3. Working with Files and Executables
      4. Interacting with User Input
      5. Using Aruba’s Ruby DSL
      6. What We Just Learned
  7. A1. Using Cucumber with Other Platforms
  8. A2. Installing Cucumber
    1. Installing Ruby
    2. HTTP Proxy Settings
    3. Installing Bundler
    4. Installing Cucumber (and RSpec)
    5. Installing Other Gems
    6. Choosing a Text Editor
  9. A3. Ruby Gem Versions
  10. A4. Bibliography

Product information

  • Title: The Cucumber Book, 2nd Edition
  • Author(s): Matt Wynne, Aslak Hellesoy, Steve Tooke
  • Release date: February 2017
  • Publisher(s): Pragmatic Bookshelf
  • ISBN: 9781680502381