'Specflow is not executing tests in Visual Studio 2019

I have a very weird behavior with Specflow that only applies to one team member. Everyone else have no issue what so ever.

The VS2019 testrunner is correctly displaying all specflow tests, but when "Running all tests" none of the tests gets executed but have the information "no source available". Specflow is generating all cs files correctly.

I tried to create a completly new solution with one unit test project in it, added specflow to it, created a feature, generated the steps and run all tests. Everything worked as expected, the test was executed and was successful. Then I added this new csproj to the other solution where the tests are not exectued. Strangly the "new test" didn't work in the old solution either.

When someone else of the project team is cloning our repository, installing specflow everything works fine for them. It is only this one machine in this one solution. I already tried to reinstall VS2019. We checked that every project in the solution has the same target platform, we tried to delete some %TEMP% files but nothing worked so far.

NuGet packages:

  • SpecFlow v3.0.225
  • SpecFlow.MsTest v3.0.225
  • SpecFlow.Tools.MsBuild.Generation v3.0.225


Solution 1:[1]

I had the same issue as you with:

  • VS 2019 v16.6.2
  • SpecFlow v3.30.2
  • SpecFlow.Tools.MsBuild.Generation v3.3.30
  • SpecRun.Runner v3.3.14
  • SpecRun.Specflow.3-3-0 v3.3.14
  • MSTest.TestAdapter v2.1.2
  • MSTest.TestFramework v2.1.2

I tried many tricks from this forum and Github SpecFlow support and none worked. When I looked at the log file, on the TestResults folder, I saw something interesting:

enter image description here

I basically logged on that link (with the same account that is logged in VS) and the tests start to run.

Hope that solves your business mate. I know these things drives anyone mad.

Solution 2:[2]

I had a similar problem with a SpecFlow Project using MSTest as unit test provider, the tests were visible in the Test-Explorer but running them had no effect. I was able to solve my problem by installing the NuGet package MSTest.TestFramework.

Solution 3:[3]

Same problem, find the .sln where the acceptance tests reside and delete the contents of the bin folder completely. Rebuild your solution and run your acceptance tests.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fábio
Solution 2 Kiroul
Solution 3 Bill Blankenship