TimeoutAttribute (NUnit 2.5)

The TimeoutAttribute is used to specify a timeout value in milliseconds for a test case. If the test case runs longer than the time specified it is immediately cancelled and reported as a failure, with a message indicating that the timeout was exceeded.

The attribute may also be specified on a fixture or assembly, in which case it indicates the default timeout for any subordinate test cases.

Example

[Test, Timeout(2000)]
public void PotentiallyLongRunningTest()
{
    ...
}

See Also...