Wednesday, August 1, 2018

Parameterization in Cucumber - Examples

Another way to pass test input to step definition method is using Examples keyword in Scenario Outline.


  Feature: Sign In

  Scenario Outline: Login Failure
    Given User is on Home Page
    And Sign In link is displayed
    When User clicks the Sign In link
    And User enters wrong "<username>" and "<password>"
    Then User should be login failed message

  Examples:
      | username  | password  |
      | username1 | password1 |
      | username2 | password2 |


The Cucumber runner will execute all the inputs in Examples table one by one in while scenario steps.

The step definition is the same as the last post.

No comments:

Post a Comment