1yraaq
Last Updated: February 25, 2016
·
1.24K
· descentintomael

Cucumber & Repetitive Scenarios

If you have multiple scenarios where you are basically changing one or two words in each, try a Scenario Outline. It allows you to define a scenario where some of the words used can be replaced using an example table.

Scenario Outline: Eat only what is edible
  Given I have a <Item>
  When I try to <Action>
  Then I should <Succeed or Fail>

  Examples:
    | Item          | Action | Succeed or Fail |
    | shoe          | eat    | fail            |
    | banana        | eat    | succeed         |
    | glass of milk | eat    | fail            |
    | glass of milk | eat    | succeed         |