The first public preview of SpecFlow 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.
.NET 4.7.1 is required. Please ensure you have installed the 4.7.1 framework.
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:
To do so:
- Select Tools | Options in Visual Studio.
- Locate Environment in the list, and select the Extensions and Updates sub-item.
- Click on Add to add a new feed.
- Give the new source a Name (e.g. “SpecFlow 3 preview”) and enter the source (“https://www.myget.org/F/specflow-vsix/vsix/”).
- Select Tools | Extensions and Updates. You should see an update listed on the left.
- 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:
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.
- Right-click on your project, and select Manage NuGet Packages.
- Enable the Include prerelease option and search for “SpecFlow”.
- Install/update the following packages:
- One of the unit test provider packages (see above).
- Install the test runner for your unit test provider (e.g. xunit.runner.visualstudio).
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.
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:
- Right-click on your project in the Solution Explorer and select Edit XYZ.csproj (where “XYZ” is the name of your project).
- Delete all elements with references to feature files (see screenshot above).
Update .NET Core versions of the example projects are located here:
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.