Closed DmitryKorolev-TomTom closed 2 years ago
My understanding is that something around these lines should work for you:
@pytest.fixture
def ctx():
return {}
@when(parsers.parse("I apply {status}"))
def apply(ctx, status):
ctx["status"] = status
@then(parsers.parse("the status is <status>"))
def check(ctx, status):
assert_that(status, equal_to(ctx["status"]))
Duplicate of #412
@DmitryKorolev-TomTom is this still a case since the refactoring? Now the scenario renders
There is a possibility to dissociate usage of step parameters and fixtures: https://github.com/elchupanebrej/pytest-bdd-ng#step-arguments-are-fixtures-as-well
Closing this as this should have been fixed in the latest versions of pytest-bdd. Please retry with the latest version of pytest-bdd, I will reopen the issue if the problem is still present.
If multiple steps are using the same parameter name, the first occurrence will populate the fixture value and that value will be used in all successive occurrences. I will illustrate it on the example:
My expectation here is that in
then
step value forstatus
will be populated from the example table. However, this is not the case as this test fails with: