Specflow test not discovered on test explorer c# Specflow test not discovered on test explorer c# selenium selenium

Specflow test not discovered on test explorer c#


After a lot of trying, I finally fixed. After deleting one of the the runners, SpecRun, I added the Specflow.Tools.MSbuild.Generation NuGet Package and it fixed the problem.

Hope it is useful for someone with the same issue!


If you are encountering the problem, and have already installed Specflow.Tools.MSBuid.Generation NuGet package in your project, and youintermittently lose your generated tests, then you should be aware that there is a bug in Specflow.Tools.MSBuild.Generation Version=2.3.2

You can upgrade to a newer version of Specflow.Tools.MSBuild.Generationor apply a workaround.

The workaround is to edit your .csproj and add a section after AfterUpdateFeatureFilesInProject.

<Target Name="AfterUpdateFeatureFilesInProject">  <ItemGroup>    <Compile Include="@(SpecFlowGeneratedFiles)" />  </ItemGroup></Target><!-- Workaround Specflow 2.3 MSBuild bug. SpecFlowGeneratedFiles      is not set if UpdateFeatureFilesInProject is up-to-date   causing tests not to be discovered, as they are not included in the project --><ItemGroup>  <Compile Include="**/*.feature.cs" Exclude="@(SpecFlowGeneratedFiles)">    <DependentUpon>%(Filename)</DependentUpon>  </Compile></ItemGroup>


Seems to me that you could be missing the Reference to TechTalk.SpecRun.Common. Please check that this is in your solution references.

If it is Referenced, your Test Adapter cache might be corrupted. Try having a look through these steps:Troubleshooting Visual Studio Integration