By default nunit tests run alphabetically. Does anyone know of any way to set the execution order? Does an attribute exist for this?
I'm suprised the NUnit community hasn't come up with anything, so I went to create something like this myself.
I'm currently developing an open-source library that allows you to order your tests with NUnit. You can order test fixtures and ordering "ordered test specifications" alike.
The library offers the following features:
The library is actually inspired in how MSTest does test ordering with .orderedtest files. Please look at an example below.
[OrderedTestFixture]
public sealed class MyOrderedTestFixture : TestOrderingSpecification {
protected override void DefineTestOrdering() {
TestFixture();
OrderedTestSpecification();
TestFixture();
TestFixture();
}
protected override bool ContinueOnError => false; // Or true, if you want to continue even if a child test fails
}