Executing SpecFlow Tests

In order to execute your SpecFlow tests, you need to define the tests as Gherkin feature files, bind the steps defined in your feature files to your code, and configure a unit test provider to execute the tests. SpecFlow generates executable unit tests from your Gherkin files.

We recommend that you add a separate project to your solution for your tests, as demonstrated in the "BookShop.AcceptanceTests" in the BookShop sample.

Configuring Your Unit Test Provider

Tests are executed using a unit test provider. 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.:

<specFlow>
  <unitTestProvider name="MsTest" />
</specFlow>