Search code examples
c#.netnunit

Timeout for individual tests in NUnit


I'm aware that there is a Timeout attribute in NUnit. My problem is that the unit tests actually spawn a new process which, if frozen, is never killed by NUnit. How can I implement a timeout which will actually get rid of the rogue process?


Solution

  • You can use timeout for assertion, instead of timeout for whole test method:

    Assert.That(actual, Is.EqualTo(expected).After(5000, 50));