Last active
August 29, 2015 13:57
-
-
Save slvnperron/9405570 to your computer and use it in GitHub Desktop.
NUnit-Retry Not Retried
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class RetryTest | |
{ | |
private static int _count = 0; | |
[Test] | |
public void WontBeRetried() | |
{ | |
if (_count++ >= 1) | |
{ | |
Assert.Pass("It's been retried"); | |
} | |
Assert.Fail(); // <--- Called, test fail. Not retried. | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class RetryTest | |
{ | |
private static int _count = 0; | |
[Test] | |
[Retry] | |
public void WontBeRetried() | |
{ | |
if (_count++ >= 1) // <-- Called twice | |
{ | |
Assert.Pass("It's been retried"); // <-- Called on the second time, test passed. | |
} | |
Assert.Fail(); // <--- Called once, but test pass because it's been run again after failure. | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
[Retry(times: 2, requiredPassCount: 2)] // Fails |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
[Retry(times: 3, requiredPassCount: 2)] // Pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
[Retry] | |
public class RetryTest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<results> | |
<test-suite type="TestFixture" name="RetryTest" executed="True" result="Success" success="True" time="0.041" asserts="0"> | |
<results> | |
<test-case name="NUnit_retry.Tests.RetryTest.WontBeRetried" executed="True" result="Success" success="True" time="0.001" asserts="0"> | |
<reason> | |
<message><![CDATA[It's been retried]]></message> | |
</reason> | |
</test-case> | |
</results> | |
</test-suite> | |
</results> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment