visual-studiospecflowtest-explorer

Go To Test (F12) doesn't work in Test Explorer in Visual Studio


When I click on Go To Test or use F12, nothing happens. This happens for SpecFlow tests in VS2019. This is an issue because it is difficult to manually find the test in the *.feature file.

Is there any way for me to make it start working again?

P.S. I found a similar issue described in https://github.com/SpecFlowOSS/SpecFlow/issues/1457

Edit: I am using VS2019 16.8.5, .NET Framework 4.8, my csproj uses the old XML format, and I am using a SpecFlow feature where *.feature.cs are not under source control.

  <Import Project="..\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\build\SpecFlow.Tools.MsBuild.Generation.targets" Condition="Exists('..\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\build\SpecFlow.Tools.MsBuild.Generation.targets')" />
  <Import Project="..\packages\SpecFlow.NUnit.3.0.225\build\SpecFlow.NUnit.targets" Condition="Exists('..\packages\SpecFlow.NUnit.3.0.225\build\SpecFlow.NUnit.targets')" />

enter image description here


Solution

  • As you already found out, this is a known issue with the old project format. There are two possible workarounds for you:

    1. convert to the new sdk format for csproj
    2. Use the SpecFlow+ Runner as unit test runner