Reputation: 11
I have three test projects in a solution. In one I create my feature files with scenarios and I add them as links in the other two (so the scenarios are completely identical but with different step implementation within the three projects). I use Visual Studio 2019 and Specflow 3 with MsTest as test runner. The packages that I've included are:
<package id="Gherkin" version="6.0.0" targetFramework="net472" />
<package id="SpecFlow" version="3.0.225" targetFramework="net472" />
<package id="SpecFlow.MsTest" version="3.0.225" targetFramework="net472" />
<package id="SpecFlow.Tools.MsBuild.Generation" version="3.0.225" targetFramework="net472" />
When I build the solution I only see the tests from the first project in Test Explorer. Tests for the project with linked feature files are not generated. Is this even possible with Specflow 3?
Upvotes: 0
Views: 197
Reputation: 5825
No, adding feature files as links is not supported.
We in the SpecFlow team came to the conclusion that we will probably never get all cases covered how linked files could be used in a projects. There are questions like where to put the generated code-behind files and other, that are always specific to the project.
Our suggestion as an alternative to linked files is to copy the feature files in a before build target. We do this our self in SpecFlow to get feature files from Cucumber. It is here: https://github.com/SpecFlowOSS/SpecFlow/blob/c227205e6e18e47da3dc46ae1b571297f8e51a37/Tests/TechTalk.SpecFlow.Specs/TechTalk.SpecFlow.Specs.csproj#L83
Full disclosure: I am one of the maintainers of SpecFlow
Upvotes: 3