Skip to content

CurrentContext.Result.Outcome.Status is inconclusive in TearDown if Timeout attribute is used in 4.x #4723

@gboucher90

Description

@gboucher90

Hi,

I know timeout attribute is deprecated in 4.x but it still seems to be a regression compared to 3.x.
It seems when using the Timeout attribute then TestContext.CurrentContext.Result.Outcome.Status is reported as Inconclusive in the Teardown method while it used to be reported as Passed before.

Example:

        [Test, Timeout(20_000)]  // Non Ok status will be Inconclusive
        public async Test_Timeout() {
              await Task.Delay(10_000);
              Assert.Pass();
        }

        [Test, CancelAfter(20_000)] // Ok status will be Passed
        public async Test_CancelAfter(CancellatonToken ct) {
              await Task.Delay(10_000, ct);
              Assert.Pass();
        }

        [Test ]  // Ok status will be Passed
        public async Test() {
              await Task.Delay(10_000);
              Assert.Pass();
        }
        [TearDown]
        public async Task Cleanup()
        {
                Console.WriteLine($"Test status = {TestContext.CurrentContext.Result.Outcome.Status}");
        }

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions