diff --git a/README.md b/README.md index d72062c..3bd5cc5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ Retry flickering test cases for xUnit and SpecFlow in .NET. [![pipeline status](https://github.com/JoshKeegan/xRetry/actions/workflows/cicd.yaml/badge.svg)](https://github.com/JoshKeegan/xRetry/actions) [![xRetry NuGet package](https://buildstats.info/nuget/xRetry)](https://www.nuget.org/packages/xRetry "Download xRetry from NuGet") -[![xRetry.SpecFlow NuGet package](https://buildstats.info/nuget/xRetry.SpecFlow?includePreReleases=true)](https://www.nuget.org/packages/xRetry.SpecFlow "Download xRetry.SpecFlow from NuGet") +[![xRetry.SpecFlow NuGet package](https://buildstats.info/nuget/xRetry.SpecFlow)](https://www.nuget.org/packages/xRetry.SpecFlow "Download xRetry.SpecFlow from NuGet") +[![xRetry.Reqnroll NuGet package](https://buildstats.info/nuget/xRetry.Reqnroll)](https://www.nuget.org/packages/xRetry.SpecFlow "Download xRetry.Reqnroll from NuGet") [//]: \# (Src: whenToUse.md) @@ -30,50 +31,6 @@ This is the intended use case of the library. If you have a test that covers some flaky code, where sporadic failures are caused by a bug, this library should **not** be used to cover it up! -[//]: \# (Src: xRetry.SpecFlow/usage.md) - -## Usage: SpecFlow 3 - -Add the [`xRetry.SpecFlow` NuGet package](https://www.nuget.org/packages/xRetry.SpecFlow "xRetry NuGet.SpecFlow package") to your project. - -### Scenarios (and outlines) - -Above any scenario or scenario outline that should be retried, add a `@retry` tag, e.g: - -```gherkin -@retry -Scenario: Retry three times by default - When I increment the default retry count - Then the default result should be 3 -``` - -This will attempt to run the test until it passes, up to 3 times by default. -You can optionally specify a number of times to attempt to run the test in brackets, e.g. `@retry(5)`. - -You can also optionally specify a delay between each retry (in milliseconds) as a second -parameter, e.g. `@retry(5,100)` will run your test up to 5 times, waiting 100ms between each attempt. -Note that you must not include a space between the parameters, as Cucumber/SpecFlow uses -a space to separate tags, i.e. `@retry(5, 100)` would not work due to the space after the comma. - -### Features - -You can also make every test in a feature retryable by adding the `@retry` tag to the feature, e.g: - -```gherkin -@retry -Feature: Retryable Feature - -Scenario: Retry scenario three times by default - When I increment the retry count - Then the result should be 3 -``` - -All options that can be used against an individual scenario can also be applied like this at the feature level. -If a `@retry` tag exists on both the feature and a scenario within that feature, the tag on the scenario will take -precedent over the one on the feature. This is useful if you wanted all scenarios in a feature to be retried -by default but for some cases also wanted to wait some time before each retry attempt. You can also use this to prevent a specific scenario not be retried, even though it is within a feature with a `@retry` tag, by adding `@retry(1)` to the scenario. - - [//]: \# (Src: xRetry/usage.md) ## Usage: xUnit @@ -151,6 +108,94 @@ type that is used by that library to the `RetryFact`. e.g. if you are using the 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. +[//]: \# (Src: xRetry.SpecFlow/usage.md) + +## Usage: SpecFlow 3 + +Add the [`xRetry.SpecFlow` NuGet package](https://www.nuget.org/packages/xRetry.SpecFlow "xRetry NuGet.SpecFlow package") to your project. + +### Scenarios (and outlines) + +Above any scenario or scenario outline that should be retried, add a `@retry` tag, e.g: + +```gherkin +@retry +Scenario: Retry three times by default + When I increment the default retry count + Then the default result should be 3 +``` + +This will attempt to run the test until it passes, up to 3 times by default. +You can optionally specify a number of times to attempt to run the test in brackets, e.g. `@retry(5)`. + +You can also optionally specify a delay between each retry (in milliseconds) as a second +parameter, e.g. `@retry(5,100)` will run your test up to 5 times, waiting 100ms between each attempt. +Note that you must not include a space between the parameters, as Cucumber/SpecFlow uses +a space to separate tags, i.e. `@retry(5, 100)` would not work due to the space after the comma. + +### Features + +You can also make every test in a feature retryable by adding the `@retry` tag to the feature, e.g: + +```gherkin +@retry +Feature: Retryable Feature + +Scenario: Retry scenario three times by default + When I increment the retry count + Then the result should be 3 +``` + +All options that can be used against an individual scenario can also be applied like this at the feature level. +If a `@retry` tag exists on both the feature and a scenario within that feature, the tag on the scenario will take +precedent over the one on the feature. This is useful if you wanted all scenarios in a feature to be retried +by default but for some cases also wanted to wait some time before each retry attempt. You can also use this to prevent a specific scenario not be retried, even though it is within a feature with a `@retry` tag, by adding `@retry(1)` to the scenario. + + +[//]: \# (Src: xRetry.Reqnroll/usage.md) + +## Usage: Reqnroll 2 + +Add the [`xRetry.Reqnroll` NuGet package](https://www.nuget.org/packages/xRetry.Reqnroll "xRetry NuGet.Reqnroll package") to your project. + +### Scenarios (and outlines) + +Above any scenario or scenario outline that should be retried, add a `@retry` tag, e.g: + +```gherkin +@retry +Scenario: Retry three times by default + When I increment the default retry count + Then the default result should be 3 +``` + +This will attempt to run the test until it passes, up to 3 times by default. +You can optionally specify a number of times to attempt to run the test in brackets, e.g. `@retry(5)`. + +You can also optionally specify a delay between each retry (in milliseconds) as a second +parameter, e.g. `@retry(5,100)` will run your test up to 5 times, waiting 100ms between each attempt. +Note that you must not include a space between the parameters, as Cucumber/Reqnroll uses +a space to separate tags, i.e. `@retry(5, 100)` would not work due to the space after the comma. + +### Features + +You can also make every test in a feature retryable by adding the `@retry` tag to the feature, e.g: + +```gherkin +@retry +Feature: Retryable Feature + +Scenario: Retry scenario three times by default + When I increment the retry count + Then the result should be 3 +``` + +All options that can be used against an individual scenario can also be applied like this at the feature level. +If a `@retry` tag exists on both the feature and a scenario within that feature, the tag on the scenario will take +precedent over the one on the feature. This is useful if you wanted all scenarios in a feature to be retried +by default but for some cases also wanted to wait some time before each retry attempt. You can also use this to prevent a specific scenario not be retried, even though it is within a feature with a `@retry` tag, by adding `@retry(1)` to the scenario. + + [//]: \# (Src: logs.md) ## Viewing retry logs diff --git a/docs/Makefile b/docs/Makefile index d94b8f3..6b67fcc 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -19,8 +19,9 @@ repo: $(call append,ciBadge.md,../README.md,0) $(call append,nugetBadges.md,../README.md,1) $(call append,whenToUse.md,../README.md,0) - $(call append,xRetry.SpecFlow/usage.md,../README.md,0) $(call append,xRetry/usage.md,../README.md,0) + $(call append,xRetry.SpecFlow/usage.md,../README.md,0) + $(call append,xRetry.Reqnroll/usage.md,../README.md,0) $(call append,logs.md,../README.md,0) $(call append,contributing.md,../README.md,0) $(call append,repo/footer.md,../README.md,0) @@ -45,5 +46,15 @@ xRetry.SpecFlow: $(call append,logs.md,../src/xRetry.SpecFlow/README.md,0) $(call append,issues.md,../src/xRetry.SpecFlow/README.md,0) +.PHONY: xRetry.Reqnroll +xRetry.Reqnroll: + echo $(GENERATED_DISCLAIMER) > ../src/xRetry.Reqnroll/README.md + $(call append,xRetry.Reqnroll/header.md,../src/xRetry.Reqnroll/README.md,0) + $(call append,ciBadge.md,../src/xRetry.Reqnroll/README.md,0) + $(call append,whenToUse.md,../src/xRetry.Reqnroll/README.md,0) + $(call append,xRetry.Reqnroll/usage.md,../src/xRetry.Reqnroll/README.md,0) + $(call append,logs.md,../src/xRetry.Reqnroll/README.md,0) + $(call append,issues.md,../src/xRetry.Reqnroll/README.md,0) + .PHONY: all -all: repo xRetry xRetry.SpecFlow \ No newline at end of file +all: repo xRetry xRetry.SpecFlow xRetry.Reqnroll \ No newline at end of file diff --git a/docs/nugetBadges.md b/docs/nugetBadges.md index 7a2330e..11e89e4 100644 --- a/docs/nugetBadges.md +++ b/docs/nugetBadges.md @@ -1,2 +1,3 @@ [![xRetry NuGet package](https://buildstats.info/nuget/xRetry)](https://www.nuget.org/packages/xRetry "Download xRetry from NuGet") -[![xRetry.SpecFlow NuGet package](https://buildstats.info/nuget/xRetry.SpecFlow?includePreReleases=true)](https://www.nuget.org/packages/xRetry.SpecFlow "Download xRetry.SpecFlow from NuGet") +[![xRetry.SpecFlow NuGet package](https://buildstats.info/nuget/xRetry.SpecFlow)](https://www.nuget.org/packages/xRetry.SpecFlow "Download xRetry.SpecFlow from NuGet") +[![xRetry.Reqnroll NuGet package](https://buildstats.info/nuget/xRetry.Reqnroll)](https://www.nuget.org/packages/xRetry.SpecFlow "Download xRetry.Reqnroll from NuGet") diff --git a/docs/xRetry.Reqnroll/header.md b/docs/xRetry.Reqnroll/header.md new file mode 100644 index 0000000..5c69548 --- /dev/null +++ b/docs/xRetry.Reqnroll/header.md @@ -0,0 +1,2 @@ +# xRetry.Reqnroll +Retry flickering test cases for Reqnroll when using xUnit. \ No newline at end of file diff --git a/docs/xRetry.Reqnroll/usage.md b/docs/xRetry.Reqnroll/usage.md new file mode 100644 index 0000000..6327319 --- /dev/null +++ b/docs/xRetry.Reqnroll/usage.md @@ -0,0 +1,40 @@ +## Usage: Reqnroll 2 + +Add the [`xRetry.Reqnroll` NuGet package](https://www.nuget.org/packages/xRetry.Reqnroll "xRetry NuGet.Reqnroll package") to your project. + +### Scenarios (and outlines) + +Above any scenario or scenario outline that should be retried, add a `@retry` tag, e.g: + +```gherkin +@retry +Scenario: Retry three times by default + When I increment the default retry count + Then the default result should be 3 +``` + +This will attempt to run the test until it passes, up to 3 times by default. +You can optionally specify a number of times to attempt to run the test in brackets, e.g. `@retry(5)`. + +You can also optionally specify a delay between each retry (in milliseconds) as a second +parameter, e.g. `@retry(5,100)` will run your test up to 5 times, waiting 100ms between each attempt. +Note that you must not include a space between the parameters, as Cucumber/Reqnroll uses +a space to separate tags, i.e. `@retry(5, 100)` would not work due to the space after the comma. + +### Features + +You can also make every test in a feature retryable by adding the `@retry` tag to the feature, e.g: + +```gherkin +@retry +Feature: Retryable Feature + +Scenario: Retry scenario three times by default + When I increment the retry count + Then the result should be 3 +``` + +All options that can be used against an individual scenario can also be applied like this at the feature level. +If a `@retry` tag exists on both the feature and a scenario within that feature, the tag on the scenario will take +precedent over the one on the feature. This is useful if you wanted all scenarios in a feature to be retried +by default but for some cases also wanted to wait some time before each retry attempt. You can also use this to prevent a specific scenario not be retried, even though it is within a feature with a `@retry` tag, by adding `@retry(1)` to the scenario. diff --git a/src/xRetry.Reqnroll/README.md b/src/xRetry.Reqnroll/README.md index 8eb7900..a72f1b0 100644 --- a/src/xRetry.Reqnroll/README.md +++ b/src/xRetry.Reqnroll/README.md @@ -28,7 +28,7 @@ this library should **not** be used to cover it up! [//]: \# (Src: xRetry.Reqnroll/usage.md) -## Usage: Reqnroll 3 +## Usage: Reqnroll 2 Add the [`xRetry.Reqnroll` NuGet package](https://www.nuget.org/packages/xRetry.Reqnroll "xRetry NuGet.Reqnroll package") to your project.