Saturday, 5 May 2018

Data tables vs scenario outline

Data tables deals with data that is attached to single step, where as in scenario outline, each row will be executed against complete scenario.

Is place holders in the table should follow the order?
Order of place holder doesn’t matter. Only column headers matter.

Feature: Example of Scenario_outline
 
 Scenario Outline: Remove balls from the box
 
  Given A box of <noOfBalls>
  When I taken <noOfBallsTaken> balls out of the box
  Then <remainingBalls> balls remaining in the box

  Examples:
   | noOfBalls | noOfBallsTaken | remainingBalls |
   |   100     |     10         |    90          |
   |   200     |     20         |    180         |
   |   100     |     30         |    70          |

We can represent above scenario like below.

Feature: Example of Scenario_outline
 
 Scenario Outline: Remove balls from the box
 
  Given A box of <noOfBalls>
  When I taken <noOfBallsTaken> balls out of the box
  Then <remainingBalls> balls remaining in the box

  Examples:
      | noOfBallsTaken | noOfBalls | remainingBalls |
      |     10         |  100      |    90          |
      |     20         |  200       |    180         |
      |     30         |  100      |    70          |

As you see the Examples: section, column names are not in the order of the test steps.


Previous                                                 Next                                                 Home

No comments:

Post a Comment