You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fork xRetry into xRetry.v3, in preparation for xUnit.v3 support
xRetry and xRetry.v3 will live side-by-side until xUnit v2 is not something we want to still work on. For now, it's still widely used & there's no v3 support in Specflow or Reqnroll. Many other xUnit extensions also don't support v3 yet, so a full switch over won't be possible for many people.
These .v3 packages are currently just copies of the existing code, still targeting xUnit v2. This skeleton will prove CI works, and be the starting point for work towards v3 support.
The same optional arguments (max attempts and delay between each retry) are supported as for facts, and can be used in the same way.
96
+
97
+
### Skipping tests at Runtime
98
+
99
+
In addition to retries, `RetryFact` and `RetryTheory` both support dynamically skipping tests at runtime. To make a test skip just use `Skip.Always()`
100
+
within your test code.
101
+
It also supports custom exception types so you can skip a test if a type of exception gets thrown. You do this by specifying the exception type to the
102
+
attribute above your test, e.g.
103
+
104
+
```cs
105
+
[RetryFact(typeof(TestException))]
106
+
publicvoidCustomException_SkipsAtRuntime()
107
+
{
108
+
thrownewTestException();
109
+
}
110
+
```
111
+
112
+
This functionality also allows for skipping to work when you are already using another library for dynamically skipping tests by specifying the exception
113
+
type that is used by that library to the `RetryFact`. e.g. if you are using the popular Xunit.SkippableFact NuGet package and want to add retries, converting the
114
+
test is as simple as replacing `[SkippableFact]` with `[RetryFact(typeof(Xunit.SkipException))]` above the test and you don't need to change the test itself.
The same optional arguments (max attempts and delay between each retry) are supported as for facts, and can be used in the same way.
55
+
56
+
### Skipping tests at Runtime
57
+
58
+
In addition to retries, `RetryFact` and `RetryTheory` both support dynamically skipping tests at runtime. To make a test skip just use `Skip.Always()`
59
+
within your test code.
60
+
It also supports custom exception types so you can skip a test if a type of exception gets thrown. You do this by specifying the exception type to the
61
+
attribute above your test, e.g.
62
+
63
+
```cs
64
+
[RetryFact(typeof(TestException))]
65
+
publicvoidCustomException_SkipsAtRuntime()
66
+
{
67
+
thrownewTestException();
68
+
}
69
+
```
70
+
71
+
This functionality also allows for skipping to work when you are already using another library for dynamically skipping tests by specifying the exception
72
+
type that is used by that library to the `RetryFact`. e.g. if you are using the popular Xunit.SkippableFact NuGet package and want to add retries, converting the
73
+
test is as simple as replacing `[SkippableFact]` with `[RetryFact(typeof(Xunit.SkipException))]` above the test and you don't need to change the test itself.
0 commit comments