SpecFlow 3 Public Preview now Available

The first public preview of SpecFlow 3 with support for .NET Core is now available. If you want to try out the new version, please read the following information carefully. There are a number of steps that are necessary before you can use the public preview.

Please report any issues you experience here.

IMPORTANT! If you do not plan on updating to SpecFlow 3 soon, please read this announcement for all current users.

Installing the Preview Visual Studio Extension

SpecFlow 3 requires an update to the Visual Studio extension for SpecFlow. During the preview period, you will need to connect to the following feed to download the preview version of the extension:

https://www.myget.org/F/specflow-vsix/vsix/

To do so:

  1. Select Tools | Options in Visual Studio.
  2. Locate Environment in the list, and select the Extensions and Updates sub-item.
  3. Click on Add to add a new feed.
  4. Give the new source a Name (e.g. “SpecFlow 3 preview”) and enter the source (“https://www.myget.org/F/specflow-vsix/vsix/”).
  5. Select Tools | Extensions and Updates. You should see an update listed on the left.
  6. Click on Updates to update the new extension.

Once a stable version of SpecFlow 3 has been released, the new version of the extension will go live for all users, and you can revert to the standard feed.

Supported Frameworks and Runners

The preview version supports the following test frameworks and runners:

  • SpecFlow+ Runner 3.0 or higher
  • NUnit 3.10 or higher
  • MSTest V2 1.3.2 or higher
  • xUnit 2.4.0 or higher

Installing NuGet Packages and Configuring a Unit Test Provider

The unit test provider is no longer configured in your app.config file. Instead, the unit test provider is now configured using plugins for the desired test frameworks. You will therefore need to add one of the following NuGet packages to your project to configure the unit test provider:

  • SpecRun.SpecFlow-3.0.0
  • SpecFlow.xUnit
  • SpecFlow.MsTest
  • SpecFlow.NUnit

Note: Make sure you do not add more than one of the unit test plugins to your project. If you do, an error message will be displayed.

  1. Right-click on your project, and select Manage NuGet Packages.
  2. Enable the Include prerelease option and search for “SpecFlow”.
  3. Install/update the following packages:
    • SpecFlow
    • SpecFlow.Tools.MsBuild.Generation
    • One of the unit test provider packages (see above).
  4. Install the test runner for your unit test provider (e.g. xunit.runner.visualstudio).

Configuration

Much of the configuration has been moved from the app.config file to other locations. When using .NET Core, you can no longer use the app.config file. You need to set general configuration options in the new specflow.json configuration file. This file is optional when using the Full Framework.

The structure of the .json configuration file reflects the structure of the old app.config. Some examples can be found here.

{
    "language":
    {
        "feature": "de-AT"
    }
}

In the above example, the feature file language is set to “de-AT”. This corresponds to the following entry in the app.config file:

<language feature="de-AT" />

If you are using the Full Framework, some settings are still available in the app.config file. However, much has changed, so please read the details below for information on how to configure SpecFlow 3.

Generating Code-behind Files

specflow.exe has been removed. Please use the SpecFlow.Tools.MsBuild.Generation NuGet package to generate the code-behind files, see https://specflow.org/documentation/Generate-Tests-from-MsBuild/

When using .NET Core or the new project format, it should be enough to simply add the package to your project.

Adding Feature Files

When adding a new feature file, several lines are added to your project file including references to the feature file. This is currently necessary for backwards compatibility with older versions. You will need to remove these lines from the project file manually whenever you add a new feature:

To remove these lines:

  1. Right-click on your project in the Solution Explorer and select Edit XYZ.csproj (where “XYZ” is the name of your project).
  2. Delete all elements with references to feature files (see screenshot above).

Sample Projects

Update .NET Core versions of the example projects are located here:

https://github.com/techtalk/SpecFlow-Examples/tree/feature/netcore-examples/NETCore%20Examples

No Reports Available

Reports have been removed from the main code base and reports are not available in SpecFlow 3.0. For more details, please refer to this GitHub issue.

SpecFlow+ Runner Restrictions

  • When using SpecFlow+ Runner, AppDomain separation is unavailable for .NET Core.
  • There is currently no support for the SpecFlow+ Runner server, meaning that adaptive test scheduling is unavailable.
  • Reports are currently unavailable for .NET Core. Let us know if this is a showstopper for you.