CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/specflow-testing

Maintains SpecFlow tests on existing .NET projects - authors Gherkin `.feature` files, writes C# `[Binding]` step definitions, runs them via xUnit/NUnit/MsTest, and migrates a project to Reqnroll. SpecFlow is the legacy .NET BDD framework and Reqnroll is its maintained fork. Use only for existing SpecFlow projects, especially mid-migration; new .NET BDD projects use `reqnroll-testing` instead.

70

Quality

88%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files
name:
specflow-testing
description:
Maintains SpecFlow tests on existing .NET projects - authors Gherkin `.feature` files, writes C# `[Binding]` step definitions, runs them via xUnit/NUnit/MsTest, and migrates a project to Reqnroll. SpecFlow is the legacy .NET BDD framework and Reqnroll is its maintained fork. Use only for existing SpecFlow projects, especially mid-migration; new .NET BDD projects use `reqnroll-testing` instead.

specflow-testing

Overview

SpecFlow is the legacy .NET BDD framework; Reqnroll forked from it in 2023 as its actively-maintained successor (reqnroll-home). This skill supports existing SpecFlow projects - for new .NET BDD work use reqnroll-testing (API-compatible).

When to use

  • An existing project uses SpecFlow and the team isn't ready to migrate.
  • Documentation maintenance for a deprecated codebase.

If starting a new .NET BDD project: stop. Use Reqnroll.

Step 1 - Install (legacy)

<PackageReference Include="SpecFlow" Version="3.9.74" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.74" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.74" />

Step 2 - Author a Feature

Same Gherkin as Reqnroll / Cucumber:

Feature: Apply promo code at checkout

  Scenario: Apply valid promo
    Given a logged-in user
    When I enter "WELCOME10" in the promo input
    Then the subtotal updates to $22.49

Step 3 - Step bindings

using TechTalk.SpecFlow;
using Xunit;

[Binding]
public class CartSteps
{
    [Given("a logged-in user")]
    public void GivenLoggedInUser() { /* ... */ }

    [When(@"I enter ""([^""]*)"" in the promo input")]
    public void WhenIEnter(string code) { /* ... */ }

    [Then(@"the subtotal updates to \$(\d+\.\d+)")]
    public void ThenSubtotalUpdates(decimal expected) { /* ... */ }
}

Compare to Reqnroll: using TechTalk.SpecFlowusing Reqnroll. Decorators identical.

Step 4 - Migrate to Reqnroll

Per reqnroll-home: "Compatible with SpecFlow, allowing quick migration of existing projects."

# 1. Remove SpecFlow packages
dotnet remove package SpecFlow
dotnet remove package SpecFlow.xUnit
dotnet remove package SpecFlow.Tools.MsBuild.Generation

# 2. Add Reqnroll equivalents
dotnet add package Reqnroll.xUnit
dotnet add package Reqnroll.Tools.MsBuild.Generation
// 3. Find/replace in code:
//   using TechTalk.SpecFlow → using Reqnroll
//   TechTalk.SpecFlow → Reqnroll
# 4. Run tests; fix any breakages
dotnet test

Most projects migrate in <1 day. The migration is mostly mechanical.

Step 5 - Run

dotnet test
dotnet test --filter "Category=critical"

Same as Reqnroll. The runner is the .NET test framework (xUnit / NUnit / MsTest).

Anti-patterns

Anti-patternWhy it failsFix
Starting new .NET BDD with SpecFlowReqnroll is the actively-maintained successor.Use reqnroll-testing.
Postponing migration indefinitelySpecFlow falls further behind .NET / IDE support.Migrate now (Step 4); the cost grows over time.
Mixing SpecFlow + Reqnroll in one solutionTwo runners; conflicts.All-or-nothing migration.

Limitations

  • Maintenance status. SpecFlow gets bug fixes occasionally; not new features.
  • .NET version compatibility. Newer .NET versions land on Reqnroll first.
  • IDE plugin updates. SpecFlow plugins for VS / Rider lag behind Reqnroll's.

References

  • reqnroll-home - Reqnroll's own description of itself as "a reboot of the SpecFlow project."
  • reqnroll-testing - the recommended skill for new .NET BDD projects.
  • cucumber-testing, behave-testing - non-.NET alternatives if rewriting.
Workspace
testland
Visibility
Public
Created
Last updated
Publish Source
GitHub
Badge
testland/specflow-testing badge