Question

Can I somehow force execution order in my features and scenarios or in Nunit tests which are generated from specflow feature file? It would be nice if I could first test all my data entering features, and than data modifying and than data deleting features.

Was it helpful?

Solution

I think that's more of a question for your test runner of choice. SpecFlow generates the tests for you from your test file, but it does not run them. You might be able to direct your test runner to run the scenarios in the order you ask.

However, my advice is that you do not attempt to order your tests. Each scenario should be be completely independent from others, so that the order the tests are run has no impact on the results. I guess it depends on what you mean by it being "nice" if they are run in a specific order. :)

OTHER TIPS

I'm using resharper pluggin to run the tests. So here is what is did to make them in a order ( I know it is not the best idea, but I have a special case. :) )

Resharper orders the tests in the alphabetical order for a given feature file.

So I named the scenarios with prefixes 1,2,3 and so on based on the order i want them to run.

Dirty, but ok method if you are desperate ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top