Answer
Scenario Outline Example
File Upload Test
Gherkin
Feature: File Upload Functionality
Scenario Outline: Upload files of different types
Given the user is on the upload file screen
When the user clicks on the Browse button
And the user enters "<filename>" onto the upload textbox
And the user clicks on the Enter button
Then the message "File uploaded successfully" should be displayed
And the file "<filename>" should appear in the uploaded files list
Examples:
| filename |
| file1.pdf |
| file2.docx |
| image.png |
| data.csv |
Login with Multiple User Roles
Gherkin
Feature: Role-Based Login
Scenario Outline: Login as different user roles
Given the application is open
When the user logs in with username "<username>" and password "<password>"
Then the user should land on the "<expected_page>" page
And the role indicator should show "<role>"
Examples:
| username | password | expected_page | role |
| admin@co.com | Admin@123 | Admin Panel | ADMIN |
| mgr@co.com | Mgr@456 | Dashboard | MANAGER |
| user@co.com | User@789 | Home | USER |
Form Validation Test
Gherkin
Feature: Registration Form Validation
Scenario Outline: Validate mandatory field messages
Given the user is on the registration page
When the user submits the form with "<field>" as empty
Then the error "<error_message>" should appear next to "<field>"
Examples:
| field | error_message |
| First Name | First Name is required |
| Email | Email is required |
| Password | Password is required |
| Mobile | Mobile number is required |
How Execution Works
- ✓4 rows in Examples = 4 separate test executions
- ✓Each row is treated as an independent scenario
- ✓Reports show each row's pass/fail individually
- ✓
<placeholder>must exactly matchExamplescolumn header
