I want to validate data on 3 servers. With below feature file, there's scenario execution duplication.
Feature:
As a tester,
I want validate info in database
Scenario Outline: Data verify server 1
Given server 1 is live
When I connect to server 1
Then server 1 has <attribute> available in <table>
Examples:
| attribute | table |
| attr1 | table1 |
| attr2 | table2 |
Scenario Outline: Data verify server 2
Given server 2 is live
When I connect to server 2
Then server 2 has <attribute> available in <table>
Examples:
| attribute | table |
| attr1 | table1 |
| attr2 | table2 |
Scenario Outline: Data verify server 3
Given server 3 is live
When I connect to server 3
Then server 3 has <attribute> available in <table>
Examples:
| attribute | table |
| attr1 | table1 |
| attr2 | table2 |
How is it possible to achieve?:
Scenario Outline: Data verify server 1
Given server 1 is live
When I connect to server 1
Then server 1 has <attribute> available in <table>
Scenario Outline: Data verify server 2
Given server 2 is live
When I connect to server 2
Then server 2 has <attribute> available in <table>
Scenario Outline: Data verify server 3
Given server 3 is live
When I connect to server 3
Then server 3 has <attribute> available in <table>
Examples:
| attribute | table |
| attr1 | table1 |
| attr2 | table2 |
Thanks.
You can consider passing the server details in your examples, something like the one shown below. Then use the server connection details (passed via examples) in your step def to check if the server is live and connect to the server then check for the respective attribute and table
Scenario Outline: Data verify servers
Given <Server> is live
When I connect to <Server>
Then server has <attribute> available in <table>
Examples:
Server | attribute | table |
<server1 connection details> | attr1 | table1 |
<server2 connection details> | attr2 | table2 |
<server3 connection details> | attr3 | table3 |