Skip to content
Latchkey

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.

dotnet test output
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.

.csproj
<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

  1. Run without --filter to confirm tests are discovered at all.
  2. Confirm dotnet test targets the test project, not the app project.
  3. Make sure the test project’s TargetFramework matches the runner’s installed runtime.

Fail the job when zero tests run

Guard against silently passing with no tests by requiring discovery.

Terminal
dotnet test --filter "Category=Unit" -- RunConfiguration.TreatNoTestsAsError=true

How to prevent it

  • Keep Microsoft.NET.Test.Sdk and 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →