c# – How to make a test fail if it takes too long?


I am using MSTest which is the default unit testing platform in visual studio and I have this test here:

    public void Board_nao_destroi_unidades_flutuantes()
        var ctor = new Construction();

It is waiting for an exception to pass but instead it loops and delays the other 92 tests. What's the way to say that if my test takes a certain amount of milliseconds it will fail?


As the MSDN website says ( http://msdn.microsoft.com/en-us/library/ms243175.aspx ) just use the Timeout attribute.

[TestMethod(), Timeout(80)]
public void MyTestMethod()
Scroll to Top