pytest-bdd icon indicating copy to clipboard operation
pytest-bdd copied to clipboard

How to use parameterized fixtures in pytest-bdd

Open Hari-G-S opened this issue 2 years ago • 1 comments
trafficstars

I am trying to use parameterized fixture in my pytest-bdd framework. Normal fixture works fine. But If I am passing parameters, it gives below error

""The requested fixture has no parameter defined for test:""

Below is my code(Sample). Waht is the correct usage here?

@pytest.fixture(params=[1,2]) def ba_data(request): print("this is fixture") return request.param

@given(parsers.cfparse('Collect testdata')) def required_data(ba_data): print(ba_data)

actual need behind this: I wanted to run entrire scenario multiple times, with dynamically generated data

Hari-G-S avatar May 24 '23 04:05 Hari-G-S