Skip to content

Add per-assembly test counts to dotnet test summary (#52128)#54513

Open
Evangelink wants to merge 1 commit into
dev/amauryleve/handshake-failure-summaryfrom
dev/amauryleve/per-assembly-test-counts-52128
Open

Add per-assembly test counts to dotnet test summary (#52128)#54513
Evangelink wants to merge 1 commit into
dev/amauryleve/handshake-failure-summaryfrom
dev/amauryleve/per-assembly-test-counts-52128

Conversation

@Evangelink
Copy link
Copy Markdown
Member

Fixes #52128.

When dotnet test runs multiple test assemblies, the per-assembly status lines previously only showed status and duration. Users had to scroll to the global summary to see the per-assembly breakdown. This change adds a compact counts block to the per-assembly summary lines that re-uses the exact same glyphs, order, and colors as the in-progress indicator, so the format stays narrow and visually consistent with what users already train on.

Format

Terminal Render
Full-ANSI AnsiTerminal [✓P/xF/↓S] (plus /rR when retries occurred)
SimpleTerminal (CI / redirected / --no-ansi) [+P/xF/?S] (plus /rR when retries occurred)

The terminal-specific glyphs mirror SimpleTerminal.RenderProgress exactly, so logs stay font- and encoding-friendly in CI environments. Colors (DarkGreen / DarkRed / DarkYellow / Gray) and order (passed / failed / skipped / retried) match AnsiTerminalTestProgressFrame.

Sample output (subprocess → NonAnsiTerminal → ASCII form)

…\TestProject.dll (net11.0|x64) failed with 1 error(s) [+1/x1/?1] (229ms)
…\OtherTestProject.dll (net11.0|x64) passed [+1/x0/?1] (221ms)
…\AnotherTestProject.dll (net11.0|x64) Zero tests ran [+0/x0/?0] (194ms)

The bracket block appears between the status word (passed / failed with N error(s) / Zero tests ran) and the duration in both call sites of AppendAssemblySummary: the mid-stream completion line, and the final per-assembly recap (only when more than one assembly ran, since the global summary already covers the single-assembly case).

Tests

  • TerminalTestReporterTests - 3 new unit tests via CapturingConsole covering the mid-stream completion line, the multi-assembly final summary, and the retried-tests path. Assertions use the ASCII glyph form because the tests run in AnsiMode.SimpleAnsi.
  • GivenDotnetTestBuildsAndRunsTests - the two existing multi-project acceptance tests (RunMultipleTestProjectsWithFailingTests and RunMultipleTestProjectsWithDifferentFailures) now also assert the per-assembly counts via a new GeneratePerAssemblyCountsRegexPattern helper, both Debug and Release.

All 8 verification runs pass locally (4 unit + 2x Debug/Release acceptance).

Dependency

This PR is stacked on #54501 because the new unit tests depend on the CapturingConsole helper introduced there. Targeting that branch; will rebase to main once #54501 merges.

When `dotnet test` runs multiple test assemblies, the mid-stream completion
line and the final per-assembly recap previously showed only the status and
duration. Users had to scroll back through the run to see how many tests
passed / failed / were skipped in each individual assembly.

This change appends a compact bracketed counts block that mirrors the in-
progress indicator exactly (same glyphs, same order, same colors):

  Full-ANSI:    [✓P/xF/↓S]      with optional /rR for retries
  SimpleTerminal: [+P/xF/?S]    with optional /rR for retries

The non-ANSI form re-uses the ASCII glyphs that `SimpleTerminal.RenderProgress`
already emits, so logs stay font- and encoding-friendly in CI and redirected
output.

Tests:
- `TerminalTestReporterTests` - 3 new unit tests covering mid-stream
  completion, multi-assembly final summary, and retried tests
- `GivenDotnetTestBuildsAndRunsTests` - the two existing multi-project
  acceptance tests now also assert the per-assembly counts via a new
  `GeneratePerAssemblyCountsRegexPattern` helper

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink requested a review from a team as a code owner May 29, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant