xRetry.SpecFlow 1.9.0

dotnet add package xRetry.SpecFlow --version 1.9.0
NuGet\Install-Package xRetry.SpecFlow -Version 1.9.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="xRetry.SpecFlow" Version="1.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add xRetry.SpecFlow --version 1.9.0
#r "nuget: xRetry.SpecFlow, 1.9.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install xRetry.SpecFlow as a Cake Addin
#addin nuget:?package=xRetry.SpecFlow&version=1.9.0

// Install xRetry.SpecFlow as a Cake Tool
#tool nuget:?package=xRetry.SpecFlow&version=1.9.0


Retry flickering test cases for SpecFlow when using xUnit.

pipeline status

When to use this

This is intended for use on flickering tests, where the reason for failure is an external dependency and the failure is transient, e.g:

  • HTTP request over the network
  • Database call that could deadlock, timeout etc...

Whenever a test includes real-world infrastructure, particularly when communicated with via the internet, there is a risk of the test randomly failing so we want to try and run it again. 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!

Usage: SpecFlow 3

Add the xRetry.SpecFlow nuget package to your project.

Scenarios (and outlines)

Above any scenario or scenario outline that should be retried, add a @retry tag, e.g:

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.


You can also make every test in a feature retryable by adding the @retry tag to the feature, e.g:

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.

Viewing retry logs

By default, you won't see whether your tests are being retried as we make this information available via the xunit diagnostic logs but test runners will hide these detailed logs by default.
To enable them you must configure your xUnit test project to have diagnosticMessages set to true in the xunit.runner.json. See the xUnit docs for a full setup guide of their config file, or see this projects own unit tests which has been set up with this enabled.


If you find a bug whilst using this library, please report it on GitHub.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.9.0 103,979 1/1/2023
1.9.0-alpha1 463 12/19/2022
1.8.0 102,727 2/26/2022
1.7.0 23,121 10/30/2021
1.6.0 13,109 6/23/2021
1.5.0 1,995 5/12/2021
1.4.1 15,791 2/23/2021
1.4.0 2,118 2/16/2021
1.3.0 29,866 1/22/2021
1.2.0 4,921 11/13/2020
1.1.0 3,851 8/19/2020
1.0.0 2,260 6/27/2020
0.5.0 671 4/10/2020
0.5.0-alpha1 574 3/27/2020
0.4.1 1,136 3/26/2020
0.4.1-alpha 425 3/26/2020
0.4.0 767 3/10/2020
0.3.2 1,311 8/2/2019
0.3.1 785 6/24/2019
0.3.0 745 5/22/2019
0.2.0 849 5/20/2019
0.2.0-alpha01 640 5/20/2019