-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute pytest-bdd scenarios in specific order #437
Comments
Did you try https://pypi.org/project/pytest-order/ with "@Scenario" decorator? |
I tried to use the marker as @pytest.mark.order(order=1) on top of Scenario: name in feature file, something like @pytest.mark.order(order=1) Is there another way ? |
When you implement scenarios in your python test file, did you apply this tag as a decorator on top of the test method ? A workaround I can share for ordering with multiple feature files without pytest-order is to seperate the implementation in multiple python files by context. Then you import each files by your given order inside a |
@arthuRHD I already have multiple feature files and step_definition files with separated scenarios. I applied the tag as decorator on scenario as I share the test methods with common steps I cannot use the tag on method directly. |
Actually, the scenarios already run in a specific order by default, namely the order in which they are listed in the feature. And the features are ordered by feature name or feature file name if the features are not named. So you can simply change the ordering of the scenarios in the feature files and the names of the features to enforce a certain order. I simply put a number in front of the feature names. Btw, I think this behavior should be documented in the README file. |
Is there any way to execute pytest-bdd scenarios in specific order. I tried with tags @pytest.mark.order(1) @pytest.mark.order(2). It is not following the order specified.
The text was updated successfully, but these errors were encountered: