Cucumber – Data Table | Code Factory


Donate : Link

Medium Blog : Link

Applications : Link

Cucumber Tutorial Index Page: Link

  • While working on automation, we may face verity of scenario, each scenario carries a different meaning & needs.
  • In previous scenario we have been taking an example of login functionality, where we just had two input parameters to be passed.
  • The scenario like “New user registration” in Facebook. In this functionality we need to pass multiple parameters like firstname, surname, mobile, password, DOB, gender, etc…
Feature: New user registration feature
     Scenario: New user registration with valid data
         Given   User navigate to Facebook login
         When    User enter first name as "Code", surname as "Factory", mobile number as "9876543210", password as "Abc@123", DOB as '01/01/2000', gender as ...
         Then    Registration was successful
  • It looks a bit of confuce. Is there any better way to manage such type of inputs, then we can go for data table.
  • Data Table is a set of inputs to be provided for a single tag. The tag can be Given, When, Then.
  • We can write above scenario with the help of data table as follows.
Feature: New user registration feature
     Scenario: New user registration with valid data
         Given   User navigate to Facebook login
         When    User enter valid data on page
         |Fields     |Value      |
         |firstname  |Code       |
         |surname    |Factory    |
         |mobile     |9876543210 |
         |password   |Abc@123    |
         Then    Registration was successful

Leave a comment