☰ See All Chapters |
Cucumber And
Each Given, When, Then keyword describes a single step. So to give more than one input, to provide more than one action, to expect more than one outcome we can use And keyword.
Example:
Feature: Login
Scenario: Successful Login to the page
Given I open Chrome browser
And I navigate to login page
When I click on login option
And I provide username as "manu.m@tools4testing.com" and password as "*****"
And I click on login button
Then Login success window should be displayed
And Login success window should welcome me
You can just repeat the same Given, When, Then keyword instead of And keyword. Cucumber doesn’t care which of these keywords you use; And keyword is simply there to help you create the most readable scenario. The above example can be written in as below without And keyword.
Feature: Login
Scenario: Successful Login to the page
Given I open Chrome browser
Given I navigate to login page
When I click on login option
When I provide username as "manu.m@tools4testing.com" and password as "*****"
When I click on login button
Then Login success window should be displayed
Then Login success window should welcome me
All Chapters