Data Driven Testing Using Cucumber

Time to introduce a new Cucumber keyword.

Scenario Outline - This is used when you want to run the same scenario for 2 or more different set of test data. e.g. In our scenario, if you want to register another user you can data drive the same scenario twice.

Examples - All scenario outlines have to be followed with the Examples section. This contains the data that has to be passed on to the scenario.

Let see how your scenario would look like if you were to data drive the sign up new user scenario.

  Scenario Outline: Data driving new user sign-up
    Given the user is on landing page
    When she chooses to sign up
    And she provides the first name as <firstName>
    And she provides the last name as <lastName>
    And she provides the email as <email>
    And she provides the password as <password>
    And she provides the confirm password again as <password>
    And she signs-up
    Then she should be logged in to the application
  Examples:
    | firstName | lastName | email             | password |
    | Sukesh    | Kumar    | [email protected] | password |

We can pass as many data rows in the example table as we want and the same scenario would run once for every data row.

Also notice that the table header names are same as the variable names passed in the steps.

Copy this scenario into your feture file and run the same.

results matching ""

    No results matching ""