Book Image

Cucumber Cookbook

By : Shankar Garg
Book Image

Cucumber Cookbook

By: Shankar Garg

Overview of this book

Table of Contents (13 chapters)
Cucumber Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Combining Doc Strings and Scenario Outlines


Now think of a situation where you are passing a Doc String but you have to combine that with a Scenario Outline. How does Cucumber behave in such a situation?

Let's think of a situation where we are specifying the requirements for the content of an e-mail, but the content is based on the role from which the e-mail is sent. So how do we specify such a requirement in a Feature file and how do we write the Step Definitions for it? Let's find out in this recipe.

How to do it…

  1. For this recipe, let's consider this Scenario:

    Scenario Outline: E-mail content verification
        Given I have a user account with <Role> rights
        Then I should receive an email with the body:
          """
          Dear user,
          You have been granted <Role> rights.  You are <details>. Please be    
          responsible.
          -The Admins
          """
    
        Examples:
          | Role    | details                                       |
          | Manager | now able to manage your...