Reputation: 131
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:
Upvotes: 12
Views: 10668
Reputation: 6385
TL;DR:
dotnet test
.Both give you more detailed logging, which will show the specific problem.
You can raise test log verbosity in Visual Studio.
CTRL+Q -> "test logging level" -> open -> set to Trace.
This is equivalent to Tools -> Options -> Test -> General -> Logging level -> set to Trace.
Then your Output Window will have detailed information.
Run the test.
Open the Output window and use the drop-down to view output from "Tests".
The logging is now detailed.
For example, I discovered that I was targetting an SDK that I don't have installed:
========== Starting test discovery ========== Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process for source(s) 'C:(...)\bin\Debug\netcoreapp3.1\MyProject.dll' exited with error: You must install or update .NET to run this application. (...)
You can also run the tests from a console.
Navigate to the solution or project folder, then run dotnet test
.
You will get detailed output.
Upvotes: 0
Reputation: 831
I had a similar issue in VS 2022 using .NET 6. I managed to get it working for NUnit with the following Nuget packages.
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Selenium.Support" Version="4.5.1" />
<PackageReference Include="Selenium.WebDriver" Version="4.5.1" />
<PackageReference Include="SpecFlow" Version="3.9.74" />
<PackageReference Include="SpecFlow.NUnit" Version="3.9.74" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.57" />
Note the key package to get the tests to actually run in the Test Exlporer was
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
Upvotes: 0
Reputation: 3366
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.
Upvotes: 0
Reputation: 535
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.
Upvotes: 1
Reputation: 585
I had the same issue as you with:
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:
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.
Upvotes: 13