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.
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
# IMPORTANT:
# The step is parsed by `parsers.parse` and not by using
# `<>`, therefore in the `app` variable will be the column
# name (app, app1, app2, ...) of the examples table instead
# of the actual value (instagram, facebook, ...).
@given(parsers.parse("Given {app} is installed on my device"))
def app_installed(request, app):
app_to_install = request.getfixturevalue(app)
# Install app ...
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 calling request.getfixturevalue(app)