Here is my feature file
Scenario Outline: Test different value for same parameter
Examples:
| app | app1 |
| instagram| facebook |
Given <app> is installed on my device
And <app1> is installed on my device
@given("<app> is installed on my device")
def app_installation(app):
install_app(app)
As of now, i cannot use app2 value with same step and i have to duplicate app_installation
with app1
parameter
Is there a way that i can use any parameter in Example which value can be mapped to app
Since pytest-bdd is reading your examples table and creates a fixture for every table entry you can load the table data dynamically. This can be done by passing the header name of the examples table column instead of the value and then using the pytest
request
fixture to retrieve the actual table value.Note: You can use
<app>
in your feature file as well, but then you have to remove the angle brackets in the @given step before callingrequest.getfixturevalue(app)