Skip to content
This repository was archived by the owner on Nov 7, 2019. It is now read-only.
/ SpecFlow.NetCore Public archive

A (hopefully) temporary solution to get SpecFlow and .NET Core to play nice

License

Notifications You must be signed in to change notification settings

stajs/SpecFlow.NetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpecFlow.NetCore

The problem

As at the time of writing (September 2016), the SpecFlow for Visual Studio 2015 extension does not play well with .NET Core projects.

The solution

Wait for the VS extension to support .NET Core projects. In the meantime, I present...

The (hopefully temporary) solution

Update your project:

  1. Include SpecFlow and your test framework of choice:

    • xUnit:

      <ItemGroup>
        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
        <PackageReference Include="SpecFlow" Version="2.1.0" />
        <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
        <PackageReference Include="xunit" Version="2.2.0" />
      </ItemGroup>
    • NUnit (Experimental):

      <ItemGroup>
        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
        <PackageReference Include="SpecFlow" Version="2.1.0" />
        <PackageReference Include="NUnit" Version="3.8.1" />
        <PackageReference Include="dotnet-test-nunit" Version="3.4.0-beta-2" />
      </ItemGroup>
    • MsTest (Experimental):

      <ItemGroup>
        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
        <PackageReference Include="SpecFlow" Version="2.1.0" />
        <PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
        <PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
      </ItemGroup>
  2. Include SpecFlow.NetCore:

    <ItemGroup>
      <DotNetCliToolReference Include="SpecFlow.NetCore" Version="1.0.0" />
    </ItemGroup>
  3. Add a precompile script:

    <Target Name="PrecompileScript" BeforeTargets="BeforeBuild">
      <Exec Command="dotnet SpecFlow.NetCore" />
    </Target>
  4. Build for your tests to be discovered.

Notes

Samples

If you build the samples solution, you should see .feature.cs files and an app.config being generated for each test framework.

Supported frameworks

.NET Core

  • netcoreapp2.0 (see #39)
  • net46
  • net461

SpecFlow itself, and by extension this project, is currently limited to running on full .NET Framework.

Test frameworks

  • xUnit
  • NUnit - Experimental support added by the community.
  • MsTest - Experimental support added by the community.

Visual Studio

Test Explorer

image

Background

About

A (hopefully) temporary solution to get SpecFlow and .NET Core to play nice

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages