Corvus.Testing.Reqnroll 5.0.3

dotnet add package Corvus.Testing.Reqnroll --version 5.0.3
                    
NuGet\Install-Package Corvus.Testing.Reqnroll -Version 5.0.3
                    
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="Corvus.Testing.Reqnroll" Version="5.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Corvus.Testing.Reqnroll" Version="5.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Corvus.Testing.Reqnroll" />
                    
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 Corvus.Testing.Reqnroll --version 5.0.3
                    
#r "nuget: Corvus.Testing.Reqnroll, 5.0.3"
                    
#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.
#:package Corvus.Testing.Reqnroll@5.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Corvus.Testing.Reqnroll&version=5.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Corvus.Testing.Reqnroll&version=5.0.3
                    
Install as a Cake Tool

Corvus.Testing.Reqnroll

Bindings that make Reqnroll specs easier to write:

  • Container bindings: a dependency injection container for each scenario or each feature, which is built, made available to your steps, and disposed for you.
  • Child objects: refer to objects stored in the scenario context from Reqnroll tables, with {name}.
  • Teardown exception handling: run every After... binding even when some fail, and report all the failures together at the end.

Requires .NET 10 and Reqnroll 3.

Getting started

If you use NUnit or MSTest, install the metapackage for your test framework. It brings in this package along with Reqnroll, the test adapter and the test SDK:

dotnet add package Corvus.Testing.Reqnroll.NUnit
dotnet add package Corvus.Testing.Reqnroll.MSTest

Otherwise, install this package on its own:

dotnet add package Corvus.Testing.Reqnroll

Then tell Reqnroll to load the bindings, in your test project's reqnroll.json:

{
  "$schema": "https://schemas.reqnroll.net/reqnroll-config-latest.json",
  "stepAssemblies": [
    { "assembly": "Corvus.Testing.Reqnroll" }
  ]
}

Container bindings

Tag a scenario (or a whole feature) with @perScenarioContainer, or a feature with @perFeatureContainer. Then add services in a binding that runs at the right point:

[BeforeScenario("@perScenarioContainer", Order = ContainerBeforeScenarioOrder.PopulateServiceCollection)]
public static void PopulateServices(ScenarioContext scenarioContext)
{
    ContainerBindings.ConfigureServices(scenarioContext, services =>
        services.AddSingleton<IStore, FakeStore>());
}

Get services in any step:

IServiceProvider serviceProvider = ContainerBindings.GetServiceProvider(this.scenarioContext);
IStore store = serviceProvider.GetRequiredService<IStore>();

For per-feature containers, use [BeforeFeature], ContainerBeforeFeatureOrder and the FeatureContext instead. The service provider is disposed when the scenario or feature ends.

Child objects

With the @useChildObjects tag, a table value in braces is replaced with the object stored in the scenario context under that name. This works with Reqnroll's table helpers, such as CreateInstance and CreateSet:

@useChildObjects
Scenario: Create a team
    Given I have stored a person as 'alice'
    When I create a team from this table
        | Name | Leader  |
        | Red  | {alice} |
Team team = table.CreateInstance<Team>(); // team.Leader is the object stored as "alice"

Teardown exception handling

Reqnroll stops running After... bindings as soon as one throws. Wrap teardown work in RunAndStoreExceptions (or RunAndStoreExceptionsAsync) so that the exception is stored and the remaining bindings still run:

[AfterScenario]
public void DeleteTestResources()
{
    this.scenarioContext.RunAndStoreExceptions(() => this.resources.DeleteAll());
}

At the end of the scenario or feature, all the stored exceptions are thrown together as one AggregateException. There are overloads for both ScenarioContext and FeatureContext.

More information

Corvus.Testing.Reqnroll is maintained by endjin and licensed under Apache 2.0.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Corvus.Testing.Reqnroll:

Package Downloads
Corvus.Testing.AzureFunctions.ReqnRoll

Integration framework that enables behavior-driven development (BDD) testing of Azure Functions using ReqnRoll (formerly SpecFlow). Provides utilities for programmatically starting, configuring, and stopping Azure Functions instances during test execution, with seamless ReqnRoll integration for writing human-readable test specifications. Supports both In-Process and Isolated Azure Functions models.

Corvus.Testing.Reqnroll.NUnit

A metapackage that references everything needed to write Reqnroll specs with NUnit and Corvus.Testing.Reqnroll: Reqnroll.NUnit, NUnit3TestAdapter, Microsoft.NET.Test.Sdk, coverlet.msbuild and Microsoft.Extensions.DependencyInjection. Updating this one package keeps them all in step.

Corvus.Testing.Reqnroll.MSTest

A metapackage that references everything needed to write Reqnroll specs with MSTest and Corvus.Testing.Reqnroll: Reqnroll.MSTest, MSTest, Microsoft.NET.Test.Sdk, coverlet.msbuild and Microsoft.Extensions.DependencyInjection. Updating this one package keeps them all in step.

Corvus.Testing.CosmosDb.Reqnroll

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.3 71 11/15/2026
5.0.2 71 11/15/2026
4.0.5 42,104 6/4/2025
4.0.3 3,301 11/30/2024
4.0.2 237 11/28/2024
4.0.1 240 11/28/2024
4.0.0 261 11/25/2024