Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace <field> in scenario.name with its corresponding value #738

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions allure-pytest-bdd/src/pytest_bdd_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def pytest_bdd_before_scenario(self, request, feature, scenario):
uuid = get_uuid(request.node.nodeid)
full_name = get_full_name(feature, scenario)
name = get_name(request.node, scenario)
# Replace <field> with its value in scenario-name
if hasattr(request.node, "callspec"):
for key, value in request.node.callspec.params["_pytest_bdd_example"].items():
name = name.replace("<{key}>".format(key=key), "{{{key}}}".format(key=key))
name = name.format(**request.node.callspec.params["_pytest_bdd_example"])
with self.lifecycle.schedule_test_case(uuid=uuid) as test_result:
test_result.fullName = full_name
test_result.name = name
Expand Down