Couple of helpful attributes for test retries:
RetryOnErrorAttribute
is like NUnit's ownRetryAttribute
, but it can be applied to whole Fixture/Suite/Assembly, and supports retry after exceptions in test, not only assertion failures- On top of that,
RetryOnTeamCityAttribute
also supports TeamCity's test retry feature NoRetryAttribute
for disabling retries
Attributes can be overriden on any level, e.g.
- MyAssembly.dll:
[RetryOnError(2)]
- MySuite.cs:
[NoRetry]
- MyTestFixture.cs:
[RetryOnTeamCity(3)]
- MyTestMethod():
[RetryOnError(4)]
This means we have two retries on assembly level in MyAssembly.dll
, but no retries in MySuite
,
if MyTestFixture
is also in MySuite
, previous attributes are overriden by RetryOnTeamCity
,
and method MyTestMethod
in MyTestFixture
is retried 4 times.