Repository navigation
How to get the step name description in pytest-bdd? #671
Unanswered
Nagendrababu1
asked this question in
Q&A
Replies: 1 comment
|
If you need that text inside your existing step function, store it before each step: # conftest.py
def pytest_bdd_before_step(request, step):
request.node._bdd_step_name = step.nameThen replace your assignment with: step_name = request.node._bdd_step_name
This was verified with pytest-bdd 9.0.1 and pytest 9.2.0. If you only need the name for logging or reporting, you can use |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
want to get this step description name "capture user logout option navigated screen" within the function. But not able to get it
@when(parsers.parse('capture "{user}" logout option navigated screen'), converters=CONVERTERS)
def step_capture_login_option_navigated_screen(context, user, request):
step_name = request.node.name #This prints Scenario name
I have tried request.node.name but it's giving the Scenario name, but I need exact step name. Please suggest possible ways to get the scenario description
All reactions