TestingCommons.Reqnroll 1.0.3

dotnet add package TestingCommons.Reqnroll --version 1.0.3
                    
NuGet\Install-Package TestingCommons.Reqnroll -Version 1.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="TestingCommons.Reqnroll" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TestingCommons.Reqnroll" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="TestingCommons.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 TestingCommons.Reqnroll --version 1.0.3
                    
#r "nuget: TestingCommons.Reqnroll, 1.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 TestingCommons.Reqnroll@1.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=TestingCommons.Reqnroll&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=TestingCommons.Reqnroll&version=1.0.3
                    
Install as a Cake Tool

TestingCommons.Reqnroll

The Reqnroll project provides extensions and utilities for behavior-driven development (BDD) testing using Reqnroll (formerly SpecFlow). It includes data table helpers and relative date/time parsing for more expressive test scenarios.

Key Components

DataTableExtensions

  • GetVerticalTableData() - Converts Reqnroll DataTable to Dictionary<string, string>
  • GetValueFromVerticalTableByName() - Extracts specific values from vertical data tables
  • Case-insensitive key lookup for flexible test data access

RelativeDateValueRetriever

  • Custom value retriever for Reqnroll.Assist that handles relative dates
  • Supports natural language date expressions in test scenarios
  • Configurable test moment for consistent test execution
  • Handles both past and future relative dates

Usage Examples

Data Table Extensions

Feature File Example:

Scenario: User registration with vertical data table
    Given I have the following user data:
      | Field     | Value              |
      | Name      | John Doe           |
      | Email     | john@example.com   |
      | Age       | 30                 |
      | IsActive  | true               |
    When I register the user
    Then the user should be created successfully

Step Definition:

[Given(@"I have the following user data:")]
public void GivenIHaveTheFollowingUserData(DataTable table)
{
    // Convert to dictionary for easy access
    var userData = table.GetVerticalTableData();
    
    var user = new User
    {
        Name = userData["Name"],
        Email = userData["Email"],
        Age = int.Parse(userData["Age"]),
        IsActive = bool.Parse(userData["IsActive"])
    };
    
    _scenarioContext["User"] = user;
}

Relative Date Value Retriever

Setup in Test Hooks:

[BeforeTestRun]
public static void BeforeTestRun()
{
    // Set a fixed test moment for consistent date calculations
    RelativeDateValueRetriever.TestMoment = new DateTime(2025, 8, 9, 14, 30, 0);
    
    // Register the custom value retriever
    Service.Instance.ValueRetrievers.Register(new RelativeDateValueRetriever());
}

Feature File with Relative Dates:

Scenario: Order processing with relative dates
    Given I have an order with the following details:
      | Field        | Value           |
      | OrderDate    | 2 days ago      |
      | DeliveryDate | in 5 days       |
      | CreatedAt    | 1 hour ago      |
      | UpdatedAt    | now             |
      | CancelledAt  | null date       |
    When I process the order
    Then the dates should be calculated correctly

Supported Date Formats

  • Past Dates: 1 day ago, 2 weeks ago, 3 months ago, 5 years ago
  • Future Dates: in 1 day, in 2 weeks, in 3 months, in 5 years
  • Current Time: now
  • Null Values: null date
  • Time Units: second(s), minute(s), hour(s), day(s), month(s), year(s)

Key Features

  • Natural Language Dates: Express dates in human-readable format in test scenarios
  • Consistent Test Execution: Fixed test moment ensures reproducible test results
  • Flexible Data Access: Easy conversion between Reqnroll DataTables and .NET objects
  • Case-Insensitive Lookup: Robust data table value retrieval
  • Null Date Support: Proper handling of optional date fields
  • Multiple Time Units: Support for years, months, days, hours, minutes, seconds
  • Past and Future: Handle both historical and future relative dates
  • Reqnroll.Assist Integration: Seamless integration with object creation from tables
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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.0.3 191 8/9/2025
1.0.2 192 8/9/2025
1.0.1 163 8/9/2025
1.0.0 159 6/27/2025
0.1.1 164 8/9/2025