• Real-Time-Automation

Scenario Outline in Cucumber Feature File

Using Scenario outline keyword we can achieve data-driven. We can run a single scenario with multiple data using examples keyword.


We try to understand the scenario outline with below example.




@sprint1
Feature: validate the login Functionality

Scenario Outline: validate the negative login functionality
Given Navigate to utest url
When Click on sign in link
And Enter email "<EMAIL>"
And Click on sign in button
Then validate the error message "<EXPECTED>"

Examples:      
| EMAIL             | EXPECTED                   |      
| school@gmail.com  | Invalidusernameorpassword. |
| school1@gmail.com | Invalidusernameorpassword. |



In the above example, EMAIL and EXPECTED are parameterized with help of examples.

we are able to run the same scenario with multiple data.


Things to Remember

  1. Always use "<parameter_name>" for parameterizing the values.

  2. At the end of the Scenario Outline, values are defined in a pipe-delimited table format using Examples.


 Examples:
 | Parameter_Name1 | Parameter_Name2 |
 | Value-1 	   | Value-2         |
 | Value-X         | Value-Y         |



15 views

©2020 by Real Time Selenium WebDriver Automation.