VariantsPlugin 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package VariantsPlugin --version 1.0.1
                    
NuGet\Install-Package VariantsPlugin -Version 1.0.1
                    
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="VariantsPlugin" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VariantsPlugin" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="VariantsPlugin" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VariantsPlugin --version 1.0.1
                    
#r "nuget: VariantsPlugin, 1.0.1"
                    
#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.
#addin nuget:?package=VariantsPlugin&version=1.0.1
                    
Install VariantsPlugin as a Cake Addin
#tool nuget:?package=VariantsPlugin&version=1.0.1
                    
Install VariantsPlugin as a Cake Tool

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 (Not tested thoroughly yet)

Disclaimer: Reqnroll.MSTest is not yet supported


Installation

  1. Add the plugin via NuGet:
    dotnet add package VariantsPlugin
    
  2. 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 installed and configured

Contribution

We welcome contributions! If you have suggestions, bug reports, or feature requests:

  1. Open an issue on the repository.
  2. Submit a pull request with your changes.

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 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. 
Compatible target framework(s)
Included target framework(s) (in 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.2.6-beta 1,029 5/16/2025
1.2.5-beta 410 5/8/2025
1.2.4-beta 292 5/6/2025
1.2.3-beta 141 5/5/2025
1.2.2-beta 144 4/30/2025
1.2.1-beta 129 4/25/2025
1.2.0-beta 158 4/24/2025
1.1.0-beta 289 4/10/2025
1.0.3-beta 294 1/15/2025
1.0.3-alpha 96 1/14/2025
1.0.2 10,427 1/8/2025
1.0.1 16,192 12/23/2024
1.0.0 131 12/19/2024