Cucumber — Data Table | Code Factory

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

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store