Album Cover

Specifying Scenarios Safely None

Close Preview
The workflow style that we saw on the previous page can be quite repetitive.
There is a better way and it's called a scenario table:
  • Columns represent inputs and outputs
  • Each row represents one complete scenario

  Scenario Outline: User calculates result with overflow detected
   Given the calculator is cleared
     And the user enters <x>
     And the user presses <operation>
     And the user enters <y>
    When the user presses equals
    Then the result should be <result>
   Examples:
    |     x    | operation |  y  | result |
    |     3    |    add    |  4  |   7    |
    |    -1    |    add    |  1  |   0    |
    | 99999999 |    add    |  1  | Error  |
    |    -3    | multiply  | -4  |  12    |
    | 50000000 | multiply  | -2  | Error  |
Tables work well to describe a series of input/output scenarios.
(Reading...)
| Tweet...
Page rating: | Rate this Page