Search code examples
c#integration-testingspecflownunit-console

How to order Test Scenarios in specflow using nunit3console


How can I order my scenarios to run in a given order?

I have a series of scenarios that depend on the previous scenario having run.

I'm running my specflow tests using nunit3console.

I haven't found anything online that seems to work.

And yes my tests do need to run in a particular order otherwise it's pointless.

Scenario: I perform first scenario

Scenario: I perform second scenario


Solution

  • NUnit by default runs tests in alphabhetical order. As of NUnit 3 you can try running these in order, reference here.

    It is not considered good practice to limit scenarios to run in a particular order though as each and every one of them sould be able to run independently of one another.

    Other posts with similar information, can be found here and here.