dotnet test "No test is available" / No Tests Found in CI
The test runner found and ran the project but discovered zero tests - usually because the test SDK/adapter packages are missing, the wrong assembly is targeted, or a filter excluded everything.
What this error means
dotnet test reports "No test is available" or "No test matches the given testcase filter" and exits, sometimes still succeeding so failures slip by unnoticed. No tests actually ran.
No test is available in /src/Orders.Tests/bin/Debug/net8.0/Orders.Tests.dll.
Make sure that test discoverer & executors are registered and platform & framework
version settings are appropriate and try again.Common causes
Missing test SDK or adapter packages
Discovery needs Microsoft.NET.Test.Sdk plus the framework adapter (xUnit/NUnit/MSTest). Without them, no tests are discovered.
An over-narrow or wrong filter
A --filter that matches nothing, or pointing at the wrong assembly/target framework, yields zero discovered tests.
How to fix it
Reference the test SDK and adapter
Ensure the test project has the runner SDK and the framework’s adapter package.
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />Check the filter and target
- Run without
--filterto confirm tests are discovered at all. - Confirm
dotnet testtargets the test project, not the app project. - Make sure the test project’s
TargetFrameworkmatches the runner’s installed runtime.
Fail the job when zero tests run
Guard against silently passing with no tests by requiring discovery.
dotnet test --filter "Category=Unit" -- RunConfiguration.TreatNoTestsAsError=trueHow to prevent it
- Keep
Microsoft.NET.Test.Sdkand the framework adapter referenced in every test project. - Treat "no tests run" as a failure so empty runs don’t pass silently.
- Match test project target frameworks to the installed runtime.