I did a recent migration of my company's legacy app from packages.config to PackageReferences. We have 5 projects: the main ASP.NET web app, a SQL connector model project, an xUnit test project, a FluentAssertions test project, and a SpecFlow project (and no I did not set this all up). My current goal was to move all of the packages.config to properly use NuGet in PackageReference in the csproj files for an eventual move from .NET Framework 4.6.1 to .NET Core. Unfortunately, we are not ready for such a move yet.
I have done the migration for all the projects. With some fiddling, all of them build and most run correctly. Our web project builds and runs (we still need proper smoke testing but it looks good so far). Our FluentAssertions and XUnit projects also build and run all of their tests flawlessly. We do have some warnings, but there is less of them then there was before this migration.
What is not working is the SpecFlow tests. Specifically, the SpecFlow tests are not being populated in the Test Explorer automatically in Visual Studio 2019. They were before this migration. We need these tests to run (for now) in our automated build process. We are fixing our technical debt in stages.
I have investigated online for the past couple of days and can make the following claims about our SpecFlow project:
Executing all tests in project: MyCompany.Specs
========== Starting test run ==========
========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========
<Target Name="EnsureNuGetPackageBuildImports" >
tag in the csproj file to get this to build since I did have the NuGet packages. Apparently, after the migration, this tag and child elements is unnecessary because the packages are centralized. <Import Project="..\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.0.0\build\net45\MSTest.TestAdapter.props')" />
<Import Project="..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props')" />
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
...and has the following section down below in the config file:<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
<unitTestProvider name="NUnit" />
</specFlow>
Any idea why SpecFlow tests would no longer show up in Test Explorer? Anything else I should check to diagnose this problem? Is there a known issue with SpecFlow with migrating from packages.config to PackageReference?
Thank you @Dude0001 for your answer. It was partially correct, but it wasn't the whole tale.
When you migrate a SpecFlow project from packages.config to PackageReference, you are trading the local NuGet packages and settings for global settings in NuGet, and, because of this, we no longer need VSIX extensions for SpecFlow (as Dude0001 stated above).
Along with that, I had to remove all of the configuration in App.config and the csproj files for the import statements and the other configuration for specflow specifically. You don't need to specify what test runner you are using with SpecFlow (NUnit in my case).
As well, I had to update NUnit and SpecFlow and their supporting NuGet packages to the latest versions for .NET Framework 4.6.1.
All of this combined to bring me to success to find the tests and run them correctly as they did before the migration.