Testland
Browse all skills & agents

specflow-testing

Legacy support for SpecFlow (.NET BDD framework that predates Reqnroll) - for projects that haven't migrated yet. Mirrors Reqnroll's API closely (Reqnroll is the SpecFlow fork). Body documents the SpecFlow patterns + the migration path to Reqnroll. Per Reqnroll's own positioning, new .NET BDD work targets Reqnroll, not SpecFlow. Use only for existing SpecFlow projects mid-migration; new projects use `reqnroll-testing` instead.

specflow-testing

Overview

SpecFlow is the historical .NET BDD framework that originated the Cucumber-for-.NET ecosystem. Reqnroll forked from it in 2023 due to slowing SpecFlow maintenance; per reqnroll-home, Reqnroll is "an open-source Cucumber-style BDD test automation framework for .NET. It has been created as a reboot of the SpecFlow project."

This skill exists to support existing SpecFlow projects. For new .NET BDD work, use reqnroll-testing - Reqnroll is API-compatible and actively maintained.

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 - Why migrate?

Reason
SpecFlow's maintenance has slowed; new versions sparse.
.NET 8+ support is more reliable on Reqnroll.
Reqnroll has community contributions; SpecFlow's stagnated.
Per reqnroll-home: the project is "open-source" and "community-driven."
New IDE plugin support targets Reqnroll first.

Step 6 - 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