Replies: 1 comment 1 reply
-
You have two options here.
Based on your requirements, I suggest 1 is your best way forward. For more info, check out the readme for @step decorator and stacking decorators. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
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