SpecFlow+ Runner Getting Started

Posted on:

Follow these eight simple steps to enhance your SpecFlow experience with SpecFlow+ Runner. If you’re already using SpecFlow in a project, you can skip the first two steps.

  1. Install the Visual Studio integration for SpecFlow

    You need to install the SpecFlow Visual Studio integration in order to use SpecFlow+ Runner. If you haven’t installed SpecFlow yet.

    Select Tools / Extensions and Updates in Visual Studio and search online for SpecFlow.

    Select the SpecFlow for Visual Studio 2013 extension to download and install. Restart Visual Studio to enable the extension.

    SpecFlow+ Runner works with Visual Studio 2010 and 2012 too, see SpecFlow documentation for details.

  2. Add a specifications project to your solution

    Feature file specifications (Gherkin scenarios) are maintained in a separate project of your solution. Add a Unit Test Project to collect and automate your feature specifications with SpecFlow.

    While you could also use a plain Class Library project, we recommend choosing a Unit Test Project.

  3. Enhance your specifications project with SpecFlow+ Runner

    PM> Install-Package SpecRun.SpecFlow


    SpecFlow+ SpecRun needs to be added to each specification project in your solution using NuGet. Select Manage NuGet Packages for the (previously created) specifications project.

    Search for SpecRun.SpecFlow and install SpecRun for SpecFlow 1.9.0 to your project.

    Installing SpecFlow+ Runner will also automatically download the SpecFlow runtime from NuGet and install it for the specifications project. In the same way you can enhance an existing SpecFlow specifications project with SpecFlow+ Runner.

    SpecFlow+ Runner is currently called SpecRun.SpecFlow and will be renamed in upcoming releases. This guide uses the name SpecFlow+ Runner for future compatibility.

    SpecFlow+ Runner depends on the runtime version of SpecFlow (currently 1.9.0), not on the Visual Studio extension for SpecFlow (currently 1.9.3).

    Adding SpecFlow+ Runner to your project will update the app.config to register the SpecFlow+ Runner plugin and select it as the unit test provider for SpecFlow.

    You can also select SpecRun+NUnit as unit test provider, to generate test assemblies for your specifications that can be executed with both SpecFlow+ Runner and NUnit. Note that SpecFlow+ Runner features (e.g. reporting) are not available when you’re executing specification tests with an NUnit based test runner (e.g. ReSharper unit test runner). We recommend using the Visual Studio Test Explorer for executing SpecFlow scenarios with SpecFlow+ Runner.

  4. Add specifications and automate your first scenario

    Start your ATDD cycle like described in SpecFlow getting started (step 3 – step 5).

  5. Control SpecFlow test execution with Visual Studio Test Explorer

    SpecFlow+ Runner provides advanced integration with Visual Studio Test Explorer. After adding your first specification and building the solution, the business readable scenario titles will show up in Visual Studio Test Explorer.

    Select Test / Windows / Test Explorer after compiling your solution.

    Scenarios are displayed with their plain text scenario title rather than a generated unit test name.

    Test Explorer allows to group scenarios by different aspects.

    Select Group By Traits to group the SpecFlow scenarios by tags applied on scenario or feature level.

    Select Group By Class to group the SpecFlow scenarios by feature (with the feature title written out in plain text).

  6. Enjoy advanced SpecFlow reporting

    For each test run SpecFlow+ Runner generates an advanced execution report. To view the report, switch to Show output from: Tests in the Output window.

    Click on the provided report file link to view the report directly in Visual Studio.

    You can configure test execution to generate reports with fixed file names. See documentation for details.

    The report provides a convenient side-by-side view of individual scenario steps and technical trace output for each step.

    Step definitions can write to the trace output to provide a lower level technical representation of the executed step (e.g. a more verbose representation of data structures that are processed in a step).

  7. Run SpecFlow tests from the command line

    Call runtests.cmd from the console to execute your specification tests from the console.

  8. Explore more SpecFlow+ Runner features

    After enhancing your SpecFlow basic experience there’s a lot more that SpecFlow+ Runner has to offer:

    • Parallel test execution
    • Detection of flickering scenarios
    • Smart test execution order
    • Test execution in different runtime environments
    • Automatic deployment configuration
    • SpecFlow integration for Team Foundation Server

Evaluating and purchasing SpecFlow+ Runner

SpecFlow+ Runner can be evaluated free of charge and fully functional without a time limit. During evaluation each test run will be delayed for a few seconds before it starts. See more details about evaluation and steps to register on the SpecFlow+ Evaluation page.

Buy SpecFlow+ for € 159 / seat