Data-driven tests in Cucumber
cucumber, data-driven-tests, yaml
Solution
You should try Scenario Outline using Examples
Normal Scenario
Scenario: Login
Given I am on login page
When I enter username "Jonas" and password "secrect" and press login
Then I get redirected to "Jonas Home Page"
Scenario Outline
Scenario Outline: Login
Given I am on login page
When I enter username <username> and password <password> and press login
Then I get redirected to <redirect_page>
Examples:
| username | password | redirect_page |
| "Jonas" | "secret" | "Jonas Home Page" |
| "Anna" | "Data" | "Annas Home Page" |
Read More: https://github.com/cucumber/cucumber/wiki/Scenario-Outlines
Problem
I've got to test a message-routing application, whose functionality is broadly as follows: - message gets sent to app - app examines message - message gets forwarded somewhere, based on the content of the message The vast majority of test cases are near-identical; generate a particular type of message, load it into the system, wait a few seconds, then check the required destination to ensure that the message was forwarded correctly. Rather than generate 100s of near-identical test cases in Cucumber, is there a recommended way to generate the one test case, and have it repeatedly cycle through all the (message, required_destination) tuples? I'd prefer to have these tuples maintained into a YAML file rather than a database, for ease of maintenance, but either solution would be fine.