What do you mean by Scenario Outline in Cucumber?

CucumberSoftware TestingAutomation Testing

We use the Scenario Outline keyword in the feature file in Cucumber. If a particular scenario needs to be executed with more than a set of data in multiple combinations, then we use the Scenario Outline.

The multiple data sets are represented in form of a table separated by (||) symbol under Examples keyword. Each row represents a group of data.

Example

Feature file.

Feature: Login Verification Feature
Scenario Outline: Login Verification
Given User lands on the home page
When Page title is Tutorialspoint
Then User keys in "<username>" and "<password>"
Examples:
| username | password |
| Selenium | t123     |
| Python   |pt123     |

Step Definition file with Then statement having parametrization.

Example

@Then (“^User keys in \"(.*)\” and \"(.*)\”$”)
public void user_keys(String username, String password){
   System.out.println("The username and password is : " + username
   +””+ password);
}
raja
Published on 11-Jun-2020 16:36:11
Advertisements