2

I am using Timeout attribute for nunit test case as below:

[Test, TestCaseSource("TestCases"), Retry(2), Timeout(10000)
public void test(){
    // Some code that runs for more than 10 seconds
}

I have gone through the documentation of nunit but it said that apart from assertion error, retry will not work but I have a situation where test times out.

I want this test to execute again as it is timing out but it executes only once using above code. Please help.

  • Let's get this person some help! – Brian Mar 1 at 20:54
  • Thanks but no answer yet :( – Ayush Goel Mar 6 at 5:53
0

Retry only works on Assertion failures. You will have to write a custom Retry attribute that retries on Errors as well. Here is one way of doing it: https://stackoverflow.com/questions/46319701/nunit-retry-on-exception-by-default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.