How to set priority for scenarios in the feature file #289
-
I have a feature with multiple scenarios and each scenario is linked to each others so I need to give priority to each scenario, any ways to set priority in reqnroll with xunit @priority:1 @priority:2 if I add this @priority:1 or @Priority1 nothing is happening it was taking scenario order of reverse alphanumeric of scenario first character |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
The short answer is no. Scenarios are (by default) executed sequentially in the order they are defined in the feature file. The only exception to that will come in the future as the Reqnroll team is working on support for Scenario level parallelization (in which case the scenarios will be executed simultaneously). If you have Scenario 2 that shares some set-up that is completed in Scenario 1, have you considered using a Background? |
Beta Was this translation helpful? Give feedback.
-
In addition to what @clrudolphi mentioned, it is important to highlight that it is not Reqnroll who decides on the order how the tests are executed, but the test runner framework you use (e.g. MsTest), so if you really need to manipulate the execution order (which is not a good practice), you should check the options provided by your test runner tool, but there are generally no easy options for that. |
Beta Was this translation helpful? Give feedback.
-
I am trying to run feature files with tagged as @ro using cmd command is it possible to run like this in reqnroll ? getting below error |
Beta Was this translation helpful? Give feedback.
If you start the app in beforetestrun and then on afterscenario make sure to reset its state and run everything sequentially (so not parallel) the test run order should not matter.
It is generally a bad practice to make scenarios depend on each other as they're then typically not really describing a scenario anymore.
If you really want to go down this path you've taken (and I'd seriously reconsider doing so) you can take a look at https://hamidmosalla.com/2018/08/16/xunit-control-the-test-execution-order/ there's a way to plug in this attribute through our plugin system.
Btw the steps should not have the Fact attribute as the steps merely describe steps in the final tests and are not test…