Executing SpecFlow Tests

With SpecFlow you can define the acceptance criteria in feature files that can be executed. These tests are usually placed in a separate project in the solution (e.g. "BookShop.AcceptanceTests" in the BookShop sample).

SpecFlow generates executable unit tests from the defined acceptance criteria (called scenarios).

Configuring Your Unit Test Provider

The execution of the tests depends on the unit test provider used by SpecFlow. Add the corresponding NuGet package to your project to define your unit test provider:

  • SpecRun.Runner
  • SpecFlow.xUnit
  • SpecFlow.MsTest
  • SpecFlow.NUnit

You can only have one unit test provider!

Configuring the Unit Test Provider with SpecFlow 2 (Legacy)

Configure your unit test provider in your project's app.config file, e.g.:

  <unitTestProvider name="MsTest" />

Visual Studio Integration

SpecFlow Visual Studio integration provides a simplified way to execute tests regardless of the provider. Use the "Run SpecFlow Scenarios" or "Debug SpecFlow Scenarios" commands from the context menu of the feature file editor or on the solution explorer nodes (project, folder, feature file).

See also Test Result and Debugging Tests.