nunit: Proper test result exception message when hitting `TimeoutAttribute`

Hey guys,

lately I was expetimenting with the TimeoutAttribute and ran into a few timeouts for my tests. I only saw a Exception doesn't have a stacktrace as a test result message, which confused me at first sight. Then I realized, the test were hitting the timeout.

I tried to dig into the code to see, if implementing a timeout exception message is possible, but havn’t found anything so far.

So I’d like to suggest a better test result message when hitting the timeout.

Code to reproduce:

[Test]
[Timeout(1000)]
public async Task Timeout()
{
    // Arrange

    // Act
    await Task.Delay(2000).ConfigureAwait(false);

    // Assert
    Assert.Pass();
}

Thanks and kind regards

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments