dimanche 24 mai 2020

NUnit test order shared among fixtures

I have a test fixture that has some cases in it (test1-test5). Logically, the test cases should run one by one horizontally:

  • all test1 cases among the different fixtures should run first
  • all test2 cases among the different fixtures should run after
  • ...

The cases should be batched together (due to another restriction).

I have tried to use the OrderAttribute but it seems like the order occurs in each fixture but not globally shared between them. Any ideas?

Here is the code sample:

[TestFixture, TestFixtureSource(nameof(TestFixture))]
public class TestCases
{
    [Test, Order(1)]
    public async Task Test1()
    {
        ...
    }

    [Test, Order(2)]
    public async Task Test2()
    {
        ...
    }

    [Test, Order(3)]
    public async Task Test3()
    {
        ...
    }

    [Test, Order(4)]
    public async Task Test4()
    {
        ...
    }

    [Test, Order(5)]
    public async Task Test5()
    {
        ...
    }
}

Aucun commentaire:

Enregistrer un commentaire