Repository navigation
Description
Overview
The file src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporter.Summary.cs has grown to 715 lines, making it harder to navigate and maintain. This task involves refactoring it into smaller, more focused partial-class files — consistent with how the rest of TerminalTestReporter is already organized.
Current State
- File:
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TerminalTestReporter.Summary.cs - Size: 715 lines
- Language: C#
Structural Analysis
The file is a partial class on TerminalTestReporter and contains three distinct concerns:
-
Test-run summary (lines 13–521):
AppendTestRunSummary,AppendSlowestTests,AppendSlowestTestLine,AppendFlakyTests,AppendFlakyTestLine,AppendRetrySummaryLines. These methods render the post-run verdict including pass/fail/skip counts, slowest-tests ranking, and retry/flaky-test details. -
Discovery summary (lines 234–349):
TestDiscovered(two overloads) andAppendTestDiscoverySummary. These methods handle the test-discovery mode output path, which is conceptually separate from execution output. -
Coverage summary (lines 523–715):
AppendCoverageSummary(public and private overloads),FormatThresholdPercentages,GetCoverageScopeLabel,GetCoverageMetricLabel,GetCoverageThresholdLabel,GetCoverageAggregationLabel,GetCoverageScopeLevelLabel. This block renders code-coverage results and threshold pass/fail results; it is self-contained and already the largest logical section.
Refactoring Strategy
Proposed File Splits
The TerminalTestReporter.Summary.cs file should be split along existing logical boundaries into three focused files:
-
TerminalTestReporter.Summary.cs(retained, trimmed)- Contents:
AppendTestRunSummary,AppendSlowestTests,AppendSlowestTestLine,AppendFlakyTests,AppendFlakyTestLine,AppendRetrySummaryLines - Responsibility: Render the post-execution run summary (verdict, counts, slowest/flaky tests, retry details)
- Estimated size: ~340 lines
- Contents:
-
TerminalTestReporter.Discovery.cs(new file)- Contents:
TestDiscovered(both overloads),AppendTestDiscoverySummary - Responsibility: Handle test-discovery mode output — tracking discovered tests and rendering the discovery summary
- Estimated size: ~120 lines
- Contents:
-
TerminalTestReporter.Coverage.cs(new file)- Contents:
AppendCoverageSummary(public + private),FormatThresholdPercentages,GetCoverageScopeLabel,GetCoverageMetricLabel,GetCoverageThresholdLabel,GetCoverageAggregationLabel,GetCoverageScopeLevelLabel - Responsibility: Render code-coverage summary and threshold results
- Estimated size: ~200 lines
- Contents:
Implementation Guidelines
- Preserve Behavior: All existing functionality must work identically after the split
- Maintain Public API:
internalandpublicmembers stay accessible with the same names (partial class guarantees this) - Test After Each Split: Run the unit and acceptance test suites after each incremental file move
- One File at a Time: Move the coverage block first (self-contained), then discovery, leaving the trimmed summary last
- No new using directives needed: All three new files share the same
usingset as today
Acceptance Criteria
-
TerminalTestReporter.Summary.csis split into focused partial files - Each new file is under 350 lines
- All unit tests pass after refactoring (
./build.sh -test/.\build.cmd -test) - No breaking changes to public or internal API
- File naming follows the existing
TerminalTestReporter.<Concern>.csconvention
Priority: Medium
Effort: Small
Expected Impact: Improved code navigability, easier focused review, reduced merge conflicts on this high-churn file
🤖 Automated content by GitHub Copilot. Generated by the Daily File Diet workflow. · sonnet46 52.3 AIC · ⌖ 5.75 AIC · ⊞ 8K · [◷]( · ◷)
- expires on Aug 2, 2026, 7:19 PM UTC
Activity
github-actions commentedon Aug 2, 2026
This issue was automatically closed because it expired on 2026-08-02T19:19:50.547Z.
Split TerminalTestReporter.Summary.cs into focused partial files
Split TerminalTestReporter.Summary.cs into focused partial files
github-actions commentedon Aug 3, 2026
This issue was automatically closed because it expired on 2026-08-02T19:19:50.547Z.
Evangelink commentedon Aug 3, 2026
Already done — this landed in #10387 (merged
acb5bafaa, 2026-08-03 08:19 UTC).The issue was auto-closed as expired at 01:09 UTC, before that PR merged, so the
Fixes #10367link had nothing left to close. It was then reopened at 08:26 UTC as part of undoing the bot's expiry closes, which is why it looks outstanding.I re-verified against current
mainrather than taking the PR's word for it:Acceptance criteria
Summary.cssplit into focused partialsCoverage.csat 179TerminalTestReporter.<Concern>.csnamingBehavior preservation — checked mechanically, not by eye. The 606 non-empty class-body lines of the pre-split
Summary.cs(acb5bafaa^) and of the five files replacing it are an identical multiset: nothing was added, dropped or edited, only moved.Validation on current
mainMicrosoft.Testing.Platform— builds fornet8.0/net9.0/netstandard2.0, 0 warnings (which is also what proves each file'susingset is exactly minimal, since IDE0005 iswarningwithEnforceCodeStyleInBuild).Microsoft.Testing.Platform.UnitTests— passing onnet8.0,net9.0,net462.Microsoft.Testing.Platform.TerminalReporterContract.UnitTests— passing onnet8.0,net9.0, confirming the reporter still compiles as a standalone shared-source consumer with no platform reference.TerminalReporterContract.propsincludes the folder via a*.csglob, so the four new partials were picked up with no manifest change needed on our side.The one genuine follow-up — adding the four new paths to
dotnet/sdk'seng/vendored-files.json, which enumerates each partial individually — is tracked separately in #10390 and is a change in that repo, not here.Closing as completed.