Skip to content

Document dotnet test whole-run zero-tests verdict and global/per-module --minimum-expected-tests (.NET 11 SDK) #55011

Description

@Evangelink

Summary

dotnet test (Microsoft.Testing.Platform path) gained a whole-run "zero tests ran" verdict with a global vs. per-module minimum-expected-tests model. This isn''t documented on Learn yet.

Implemented in microsoft/testfx#7457 via testfx PR microsoft/testfx#9709 (per-module signal) and SDK PR dotnet/sdk#55362 (whole-run aggregation). Available starting with the .NET 11 SDK (11.0.1xx) (merged for 11.0-preview7); not available in .NET 10 or earlier.

Behavior to document

  • Arguments before -- are global / whole-run (interpreted by the dotnet test orchestrator); arguments after -- are local / per-module (forwarded to each test module). Example:
    dotnet test --minimum-expected-tests 5 -- --minimum-expected-tests 2
    
    = at least 5 tests across the whole run and at least 2 tests per module.
  • A module that matches no tests (e.g. under --test-modules or a global --filter) exits 8 (ZeroTests) but is normalized to success before aggregation; the whole-run zero-tests verdict is decided once from the total test count, so one empty module no longer fails the whole run. The empty module keeps its Exit code: 8 diagnostic for visibility.
  • An explicit --minimum-expected-tests N that isn''t met yields 9 (MinimumExpectedTestsPolicyViolation), kept distinct from 8 so a stricter (global or per-module) minimum isn''t confused with an empty module.

Pages likely affected

  • dotnet test command reference (MTP options, argument-split semantics).
  • Microsoft.Testing.Platform exit codes table (clarify 8 vs 9 and the per-module vs whole-run distinction).

Notes

  • --minimum-expected-tests 0 is intentionally not an alias for --ignore-exit-code 8; use --ignore-exit-code 8 to suppress the zero-tests code.

Filed to track the Learn documentation for a feature that has already shipped in the product.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions