1

I created few tests in XUnit (.NET CORE 5) Here is my code:

public class SerialTest
{
    [Fact]
    public async Task Test1()
    {
        await Task.Delay(TimeSpan.FromSeconds(5));
        Assert.True(true);
    }

    [Fact]
    public async Task Test2()
    {
        await Task.Delay(TimeSpan.FromSeconds(5));
        Assert.True(true);
    }
}

This tests should work serially - Test1 should be finished before Test 2. But it's not happening. This is how its working: enter image description here

How to change it?

MrRav3n
  • 85
  • 6

1 Answers1

-2

The usual response to this is that well constructed unit tests should be able to run in any order, but ...

https://hamidmosalla.com/2018/08/16/xunit-control-the-test-execution-order/

Neil W
  • 7,670
  • 3
  • 28
  • 41