You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have already asked this, but it seems my question was understand wrong. I would like one more attempt :)
Is there a way to use Then steps for When definitions with pytest-bdd?
Example,
I have the step in my scenario
Then User downloads the file "test_file.txt"
But my definitions is
@when(parsers.parse('User downloads the file "{file_name}"'))
def step_user_downloads_file(bdd_context, file_name):
pass
There is the error about step is not found. I have scenarios where same step is used with "When" keyword. I would like to use with both. But more globally, i would like to use any step definitions with any of keywords When/Then/Given/And .
Is it possible?
Or there are some "best practices" or rules against this?
More info.
The question is , can i write Then User downloads the file "test_file.txt"
if my declaration is @when(parsers.parse('User downloads the file "{file_name}"'))
I mean, the step was declared with the "when", but i used the step with "then".
When i tested this i have got the error , something like "step is not found" or so.
If i write (When instead of Then) When User downloads the file "test_file.txt"
Then the step can be found fine. So, this is not where to write a step declaration, it is about the key word is different.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have already asked this, but it seems my question was understand wrong. I would like one more attempt :)
Is there a way to use Then steps for When definitions with pytest-bdd?
Example,
I have the step in my scenario
Then User downloads the file "test_file.txt"
But my definitions is
There is the error about step is not found. I have scenarios where same step is used with "When" keyword. I would like to use with both. But more globally, i would like to use any step definitions with any of keywords When/Then/Given/And .
Is it possible?
Or there are some "best practices" or rules against this?
More info.
The question is , can i write
Then User downloads the file "test_file.txt"
if my declaration is
@when(parsers.parse('User downloads the file "{file_name}"'))
I mean, the step was declared with the "when", but i used the step with "then".
When i tested this i have got the error , something like "step is not found" or so.
If i write (When instead of Then)
When User downloads the file "test_file.txt"
Then the step can be found fine. So, this is not where to write a step declaration, it is about the key word is different.
is this supported?
Beta Was this translation helpful? Give feedback.
All reactions