Error : No tests found to run - while debugging/running C# Unit test cases -- Visual studio 2017 15.5.1 not discovering test cases.
Framework Microsoft.NET framework 4.6.1
Added Test adapters as below MSTest.TestAdapter.1.2.0 MSTest.TestFramework.1.2.0
Test explorer not showing the test cases.
This started happening after upgrading visual studio. Some unit test projects test cases do not get discovered in the test explorer. When try to debug or run it says "No tests found to run."
I tried deleting project and recreating it again .. but didn't worked.
Output [4/3/2018 2:59:25 PM Informational] No tests found to run.
I have updated VS to 15.6.4 Deleting VS test cache files DEL %TEMP%\VisualStudioTestExplorerExtensions Restarted Visual studio
Test cases got discovered but not debugging
To start debugging: In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.
Once you have your launch configuration set, start your debug session with F5. Alternatively, you can run your configuration through the Command Palette (Ctrl+Shift+P) by filtering on Debug: Select and Start Debugging or typing 'debug ' and selecting the configuration you want to debug.
Starting in Visual Studio 2022 Update 2, you can enable faster code coverage test results by selecting Tools > Options > Environment > Preview Features, then selecting Code coverage experience improvements, and then restarting Visual Studio.
As of today, me using NUnit @ VSCode and .NET Core 5.0 was missing Microsoft.NET.Test.SDK NuGet package.. As soon as I added it to ALL test assemblies (i.e.: all .csproj files in solution .sln), everything works fine. HTH to many who reach this far.
These PackageReferences are in my TestProject.csproj
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.1"/>
<PackageReference Include="NUnit.Console" Version="3.12.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0-beta.2"/>
<PackageReference Include="NUnitTestAdapter" Version="2.3.0"/>
<PackageReference Include="NUnit.Extension.NUnitProjectLoader" Version="3.6.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0-release-20210422-02"/>
</ItemGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With