Cucumber Cookbook

Book description

Over 35 hands-on recipes to efficiently master the art of behaviour-driven development using Cucumber-JVM

In Detail

Today, behaviour-driven development (BDD) is gaining popularity around the world. Cucumber-JVM is one of the fastest growing tools and offers a cutting-edge platform for conceptualizing and implementing BDD. The variety of features available within Cucumber enhances the experience of implementing BDD for both business and development teams.

This book provides you with the skills you need to successfully create, customize, and configure the Cucumber framework. You will discover how to create Feature files, and Step Definitions, and enable various configurations, such as "Before" and "After" functions, with fun exercises. You'll round off your learning by creating automation frameworks to automate Web, REST, and Mobile apps.

What You Will Learn

  • Explore the usage of the Gherkin Language to write meaningful and smart Feature files
  • Understand Scenario, Steps, Backgrounds, Scenario Outlines, and Data Tables
  • Discover the concepts of Glue Code and Step Definitions in detail
  • Gain insights into the different types of Step Definitions, Regular Expressions, Doc Strings, Data Table transformations, and Capture Groups
  • Master the advanced concepts of implementing Tags and Hooks
  • Override default Cucumber options and settings along with different output report formats
  • Run Jenkins and Cucumber from Terminal while running various Cucumber Scenarios in parallel

Table of contents

  1. Cucumber Cookbook
    1. Table of Contents
    2. Cucumber Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Writing Feature Files
      1. Introduction
      2. Writing your first Feature file with one Scenario
        1. How to do it…
        2. How it works…
          1. Feature
          2. Scenarios
          3. Steps
      3. Creating Scenarios with different Steps
        1. How to do it…
        2. How it works…
      4. Creating a Scenario with the And and But keywords
        1. Getting ready…
        2. How to do it…
        3. How it works…
      5. Writing a Feature file with multiple Scenarios
        1. How to do it…
        2. How it works…
      6. Adding Backgrounds to Feature files
        1. Getting ready
        2. How to do it…
        3. How it works…
      7. Sending multiple arguments in Steps
        1. How to do it…
        2. How it works…
      8. Using complex data types to store data
        1. Getting ready
        2. How to do it…
        3. How it works…
      9. Implementing Scenario Outlines
        1. Getting ready
        2. How to do it…
        3. How it works…
      10. Creating a Feature file in a language other than English
        1. How to do it…
        2. How it works…
      11. Combining Scenarios, Backgrounds, and Scenario Outlines
        1. How to do it…
        2. How it works…
    9. 2. Creating Step Definitions
      1. Introduction
      2. Creating your first Step Definitions file
        1. How to do it…
        2. How it works…
          1. Step Definitions
          2. Undefined Steps
          3. Pending Steps
          4. Implemented Steps
      3. Identifying Duplicate and Ambiguous Step Definitions
        1. How to do it…
        2. How it works…
      4. Using Regular Expressions to optimize Step Definitions
        1. How to do it…
        2. How it works…
      5. Using Optional Capture and Noncapture Groups
        1. How to do it…
        2. How it works…
      6. Transforming Data Tables to parse the test data
        1. How to do it…
        2. How it works…
      7. Implementing data table diffs to compare tables
        1. How to do it…
        2. How it works…
      8. Using Doc Strings to parse big data as one chunk
        1. How to do it…
        2. How it works…
      9. Combining Doc Strings and Scenario Outlines
        1. How to do it…
        2. How it works…
      10. Defining String transformations for better conversions
        1. Getting ready
        2. How to do it…
        3. How it works…
    10. 3. Enabling Fixtures
      1. Introduction
      2. Tagging
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. ANDing and ORing Tags
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Adding Hooks to Cucumber code
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      5. Tagging the Hooks
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. ANDing and ORing tagged Hooks
        1. Getting ready
        2. How to Do it
        3. How it works…
    11. 4. Configuring Cucumber
      1. Introduction
      2. Integrating Cucumber with JUnit
        1. How to do it…
        2. How it works…
      3. Overriding the Cucumber Options
        1. How to do it…
        2. How it works…
      4. Running Strict and Running Dry
        1. How to do it…
        2. How it works…
      5. Configuring the Cucumber Console output
        1. How to do it…
        2. How it works…
      6. Directing the Cucumber output to a file
        1. How to do it…
        2. How it works…
      7. Configuring the naming conventions
        1. How to do it…
        2. How it works…
    12. 5. Running Cucumber
      1. Introduction
      2. Integrating Cucumber with Maven
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Running Cucumber from the Terminal
        1. How to do it…
        2. How it works…
      4. Overriding Options from the Terminal
        1. How to do it…
        2. How it works…
      5. Integrating Cucumber with Jenkins and GitHub
        1. Getting ready
        2. How to do it…
        3. How it works…
      6. Running Cucumber test cases in parallel
        1. How to do it…
        2. How it works…
    13. 6. Building Cucumber Frameworks
      1. Introduction
      2. Building a Web Automation framework
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Building a Mobile Automation framework
        1. Getting ready
        2. How to do it…
        3. How it works…
      4. Building a REST Automation framework
        1. How to do it…
        2. How it works…
    14. Index

Product information

  • Title: Cucumber Cookbook
  • Author(s): Shankar Garg
  • Release date: June 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781785286001