Configuring SpecFlow for XUnit using new-style csproj
[This post is now obsolete - you should look at updating to later versions of SpecFlow]
While you cannot yet use SpecFlow with netcore or netstandard projects, you can use new-style (dotnet) test projects that target net461, and reference netstandard projects-under-test from there.
We like to use XUnit as the underlying test provider in this scenario, and we do the following:
- Install the current SpecFlow VS 2017 extension into VS 2017
- Create a DotNetCore XUnit test project and perform any package updates offered to you (this handily sets up the VS2017 test environment properly)
- Change the
<TargetFramework>in the .csproj file fromdotnetcore2.xtonet461(or 462, or whatever, but 461 is a good safe lowest common denominator for most scenarios) - Add the SpecFlow.XUnit package to your project
- Add an
app.configfile to configure XUnit code generation
You can now add feature files and generate steps in the normal way.