Open idea1002 opened 3 years ago
Did you try https://pypi.org/project/pytest-order/ with "@scenario" decorator?
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) Scenario: This is first test
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 test_entrypoint.py
. Each test will be collected organically.
@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.