VariantsPlugin 2.0.5
dotnet add package VariantsPlugin --version 2.0.5
NuGet\Install-Package VariantsPlugin -Version 2.0.5
<PackageReference Include="VariantsPlugin" Version="2.0.5" />
<PackageVersion Include="VariantsPlugin" Version="2.0.5" />
<PackageReference Include="VariantsPlugin" />
paket add VariantsPlugin --version 2.0.5
#r "nuget: VariantsPlugin, 2.0.5"
#:package VariantsPlugin@2.0.5
#addin nuget:?package=VariantsPlugin&version=2.0.5
#tool nuget:?package=VariantsPlugin&version=2.0.5
ReqNRoll Plugin: Tag Variant Extender
Repository
This plugin extends the functionality of ReqNRoll by enabling automatic generation of additional test cases based on tag variants, ensuring comprehensive test coverage.
Features
| Feature | Description |
|---|---|
| Automated Test Cases | Generates test cases for scenarios based on tag variants. |
| Easy Integration | Works seamlessly with ReqNRoll workflows. |
| Customizable Tags | Allows you to define and configure your own tag variants. |
| Improved Test Coverage | Broadens coverage by handling all tag combinations. |
Variants Plugin notes
One of the following unit test providers package should be installed:
- Reqnroll.NUnit
- Reqnroll.XUnit
- Reqnroll.MSTest
Installation
- Add the plugin via NuGet:
dotnet add package VariantsPlugin - Ensure your project references ReqNRoll and is set up correctly.
Usage
Step 1: Add Variant Key at reqnroll.json
{
"variantkey": "Browser"
}
Step 2: Annotate Scenarios with Tags
Use tags in your scenarios:
@Browser:Chrome
@Browser:Firefox
Scenario: Access Dashboard
Given the user is logged in
When they navigate to the dashboard
Then they should see their account summary
Step 3: Access the variant
The variant key/value can then be accessed via the ScenarioContext static or injected class.
[Binding]
public sealed class Hooks
{
private readonly ScenarioContext _scenarioContext;
private IWebDriver _driver;
public Hooks(ScenarioContext scenarioContext)
{
_scenarioContext = scenarioContext;
}
[BeforeScenario]
public void BeforeScenario()
{
_scenarioContext.TryGetValue("Browser", out var browser);
switch (browser)
{
case "Chrome":
_driver = SetupChromeDriver();
break;
case "Firefox":
_driver = SetupFirefoxDriver();
break;
default:
_driver = SetupChromeDriver();
break;
}
_scenarioContext.ScenarioContainer.RegisterInstanceAs(_driver);
}
...
}
Step 4: Run Your Tests
The plugin generates scenarios for all tag combinations.
Example Output
For the following configuration in reqnroll.json:
"variantkey": "Browser"
@Browser:Chrome @Browser:Firefox @Browser:Safari
Scenario: This is a scenario
Given this
When that
Then this
A scenario tagged with @Browser will generate tests for:
| Browser |
|---|
| Chrome |
| Firefox |
| Safari |
In every Test generated, Scenario Context includes the specified Variant. For Example in test "This_is_a_scenario_Chrome" ScenarioContext["Browser"] contains "Chrome".
Configuration Options
| Option | Description |
|---|---|
| Variant Declaration | Specify tags and their variants. Example: "variantkey": "Browser" "Browser" is now a variant |
| Tags with Variants | Add tags containing Variant key on Scenario or Feature level (can't be on both levels). Example: @Browser:Chrome @Browser:Firefox |
Requirements
- .NET Version: .NET 7.0 or higher
- Dependencies: ReqNRoll version >= 3.1.2
Contribution
We welcome contributions! If you have suggestions, bug reports, or feature requests:
- Open an issue on the repository.
- Submit a pull request with your changes.
Additional Functionality (Only for NUnit): Retry Mechanism
Step 1: Enable retries at reqnroll.json
{
"VariantKey": "Operator",
"IsRetryActive": {
"Enabled": true,
"ApplyGlobally": true,
"GlobalMaxRetries": 4
}
}
ApplyGlobally adds retries to all tests of your framework and GlobalMaxRetries is the number of retries that are going to be applied for all tests.
If GlobalMaxRetries is set to true Enabled (simple tag retry functionality) mentioned below won't work.
Step 2: Use Retry Tag to Scenario Level or Feature level
@Retry
Scenario: This is a scenario
Given this
When that
Then this
Hint: Retry tag applies retry up to 3 times. If you need to have more or less use @Retry(n) tag.
License
This plugin is licensed under the MIT License. See LICENSE for details.
Contact
For support or inquiries, reach out to AnThivaios at anthivaios@gmail.com.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
- ReqnRoll (>= 3.3.3)
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 |
|---|---|---|
| 2.0.5 | 13,290 | 3/12/2026 |
| 2.0.4 | 364 | 3/3/2026 |
| 2.0.3 | 149 | 3/3/2026 |
| 2.0.2 | 35,080 | 12/3/2025 |
| 2.0.1 | 10,653 | 11/27/2025 |
| 2.0.0 | 807 | 11/21/2025 |
| 1.2.6-beta | 13,062 | 5/16/2025 |
| 1.2.5-beta | 1,782 | 5/8/2025 |
| 1.2.4-beta | 634 | 5/6/2025 |
| 1.2.3-beta | 211 | 5/5/2025 |
| 1.2.2-beta | 216 | 4/30/2025 |
| 1.2.1-beta | 213 | 4/25/2025 |
| 1.2.0-beta | 233 | 4/24/2025 |
| 1.1.0-beta | 375 | 4/10/2025 |
| 1.0.3-beta | 376 | 1/15/2025 |
| 1.0.3-alpha | 181 | 1/14/2025 |
| 1.0.2 | 45,144 | 1/8/2025 |
| 1.0.1 | 16,272 | 12/23/2024 |
| 1.0.0 | 222 | 12/19/2024 |
Ignored tests get ignore status and are not retried