Open EtharAlali opened 3 years ago
SpecRun.SpecFlow
and SpecFlow.NUnit
can't be installed at the same time in a SpecFlow project. They are used to configure which unit test runner is used.
I assume that you had SpecFlow+ Runner
selected, when creating the SpecFlow project. This adds the SpecRun.SpecFlow
NuGet package. And as you add then manually the SpecFlow.NUnit
package, you are getting this error.
You can select NUnit in the project wizard, to get from the start a project with NUnit.
This has nothing todo with Resharper or the .NET Core SDK and the behavior is there since SpecFlow 3.0.
Docs for Unit Test Provider: https://docs.specflow.org/projects/specflow/en/latest/Installation/Unit-Test-Providers.html
SpecFlow Version:
Used Test Runner
Version number: 3.17.0
Project Format of the SpecFlow project
packages.config
<PackageReference>
tags.feature.cs files are generated using
SpecFlow.Tools.MsBuild.Generation
NuGet packageSpecFlowSingleFileGenerator
custom toolVisual Studio Version
Enable SpecFlowSingleFileGenerator Custom Tool
option in Visual Studio extension settingsAre the latest Visual Studio updates installed?
<Major>.<Minor>.<Patch>
.NET Framework:
Test Execution Method:
<SpecFlow> Section in app.config or content of specflow.json
Issue Description
When creating a basic project and running Unit Tests, SpecFlow does not run and causes an error. Even using a basic calculator project. Unit tests work fine without SpecFlow and it can be made to work without ReSharper (ReSharper Test Runner is just a wrapper around NUnit, so in older versions of SpecFlow, 1.x.y to 2.x.y this just worked out of the box).
Errors:
Steps to Reproduce
Must have ReSharper installed. Then
Doesn't build. Error shown: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly.
This also happens regardless of ReSharper or MSTest runner. However, when you;
<PackageReference Include="SpecRun.SpecFlow" Version="3.6.2" />
from the BDD .csproj fileAdditional info:
It's possible to get it to run intermittently from this position. Though at this stage, it's not at all clear how it happens. The relevant parts of the .csproj file looks like:
Once the tests have been added to the Resharper test runner though, they work and continue to work! So there's something about that first generation of binding that something seems not to like.
Repro Project
https://www.dropbox.com/s/45bxz30sh6xis4z/WebApi.Stuff.Test.Unit.zip?dl=0