Skip to content

Add expected-duration warnings to MSTest - #12255

Merged
Amaury Levé (Evangelink) merged 4 commits into
mainfrom
evangelink-slow-test-reporting
Nov 6, 2026
Merged

Amaury Levé (Evangelink) merged 4 commits into
mainfrom
evangelink-slow-test-reporting

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Pull request

Summary

Fixes #12245.

Add opt-in MSTest [ExpectedDuration(milliseconds)] soft budgets. Completed
Passed/Failed results over budget produce a live warning and matching per-result
output without changing outcomes, counts, timeouts, or cancellation. Data rows
are independent; only final retry attempts are evaluated.

Keep the implementation in MSTest's framework/adapter and existing reporting
channels: no new MTP outcome, protocol, CLI option, history service, or platform
extension hook.

Design and decision record

Maintained decision record and executable evidence.

The original top-N request in #3495 was already delivered by #9894; explicit
budgets answer a different question and work locally without history. A single
positive maximum is enough for the initial feature. Existing [Timeout] remains
the separate failure/cancellation mechanism.

Three pre-publication review passes identified and fixed two concrete issues:
advisory message/trace failures could replace completed results and bypass
cleanup, and F3 precision hid one-tick overruns. Delivery failures are now retained
in the affected result's output, remaining rows/cleanup proceed, and F4 preserves
tick precision. The final targeted source review found no further
high-confidence correctness issue.

Demonstration

Readable transcript from the actual packed .NET 10 demo (real bodies,
deterministic reported durations), inspected in a 153-column by 63-row terminal
with ANSI on/off and long labels containing <, &, and quotes:

Test 'DurationDemo.DurationBudgetExamples.OneTickOverBudget' took 100.0001 ms, exceeding its expected maximum duration of 100 ms.

Test run summary: Passed!
  total: 5
  failed: 0
  succeeded: 5
  skipped: 0

The 500-ms, exactly-1000-ms, and unannotated-1500-ms cases do not warn. Both
over-budget cases remain Passed. A text transcript is clearer than video for
this diagnostic change; the decision record also documents the earlier
80-column rendered check and the viewport-resize limitation.

Reproduce the packaged contract through the exact
ExpectedDurationTests selection below. The consumer uses MSTest 5.0.0-dev /
MTP 3.0.0-dev from the matching Release shipping feed; private package caches,
resolved asset graphs, loaded assembly paths, and payload hashes were checked.
No hosted CI/IDE UI or Native AOT publish is claimed.

Validation and regression proof

Reviewed head: c801f3609450e84a6ce616cb82435586602f334e.
Validated source content is the initial feature commit
835519664dcbd1ee2a613c6859fb9444a90fb64d plus the reviewed behavior patch
SHA-256 195A747DFC881A8A59D4FD9631A58ACB107C47CB8A8932281D1B1E0CFA41B893;
the final commit preserves those tested source/test bytes.

Windows/x64, Release, pinned SDK 12.0.100-alpha.1.26509.101.
Let $S identify a run-owned results directory:

.\build.cmd -pack -c Release -bl /bl:artifacts\log\Release\duration-review-final-pack.binlog
# Passed, exit 0; zero warnings/errors and package-content/metadata validation passed.

.\.dotnet\dotnet.exe test --project test\UnitTests\TestFramework.UnitTests\TestFramework.UnitTests.csproj -c Release -f net10.0 --no-restore -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$S\final-framework" "-bl:$S\final-framework-green.binlog" --treenode-filter "/*/*/ExpectedDurationAttributeTests/*" --show-test-results all
# Passed: 1 selected/executed/passed, exit 0.

.\.dotnet\dotnet.exe test --project test\UnitTests\MSTestAdapter.PlatformServices.UnitTests\MSTestAdapter.PlatformServices.UnitTests.csproj -c Release -f net10.0 --no-restore -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$S\final-runners" "-bl:$S\final-runners-green.binlog" --treenode-filter "/*/*/*Test*RunnerTests/*" --show-test-results all
# Passed: 42 TestMethodRunnerTests + 37 UnitTestRunnerTests = 79, exit 0.

.\.dotnet\dotnet.exe test --project test\IntegrationTests\MSTest.Acceptance.IntegrationTests\MSTest.Acceptance.IntegrationTests.csproj -c Release -f net12.0 --no-restore -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$S\final-acceptance" "-bl:$S\final-acceptance-green.binlog" --filter "FullyQualifiedName~MSTest.Acceptance.IntegrationTests.ExpectedDurationTests" --show-test-results all
# Passed: all 6 host/metadata cases executed, exit 0.

python .github\scripts\test_check_localization.py
python .github\scripts\check_localization.py
# Passed: 41 guard tests and all 364 catalogs; both exits 0.

Acceptance explicitly uses MSTEST_ACCEPTANCE_SKIP_SOURCEGEN=0 and a fresh,
marked run-owned consumer cache. Independent discovery and fresh TRX execution
gates pass for each module: 86 distinct tests passed, zero failed/skipped.
The six metadata cases use .NET 11/C# 12 generated consumers; the outer host is
.NET 12. CI, Native AOT publishing, hosted/IDE UI, and other runtime platforms
were not run for this local validation.

Requirement Automated evidence / consumed surface
Boundaries, opt-in, exclusions, culture ExecuteExpectedDuration_UsesStrictReportedDurationBoundary, ExecuteExpectedDuration_WithoutAttributeDoesNotWarnOrChangeOutput, ExecuteExpectedDuration_DoesNotWarnForSkippedTimeoutOrInfrastructureResults, ExecuteExpectedDuration_FormatsFractionalMillisecondsWithCurrentCulture
Original outcomes/output and final attempts ExecuteExpectedDuration_PreservesOutcomesExceptionsAndAuthoredOutput, ExecuteExpectedDuration_DoesNotWarnForSupersededAttempts; real retries in the packed cases
Diagnostic failures cannot change results or cleanup Five RunSingleTestExpectedDuration_*PreservesResultsAndCleanup cases: I/O, cancellation, ordinary host, trace-double-fault, and hostile exception Message getter
Real MTP/VSTest, row identity and TRX association Mtp_ExpectedDuration_PreservesWarningsAndResultAssociations and Vstest_ExpectedDuration_PreservesWarningsAndResultAssociations, each in Reflection, Rooting, and ReflectionFree metadata modes

Each mixed child retains 10 Passed / 1 Failed / 2 skipped leaf results, with
its expected MTP exit 2 or VSTest exit 1; passing-only children exit 0. Outer
acceptance cases pass while asserting those intentional child failures.

Test-value evidence

Contract / comparison Without correct behavior Correct reviewed head
Logger/trace faults, cleanup, and precision; same 11 focused tests On pre-fix 835519664: 9 intended assertion failures, 2 negative-control passes, 0 skips; exit 2. All 11 pass, including I/O/cancellation/host, double trace fault, hostile Message getter, later rows and class/assembly cleanup.
Actual MTP/VSTest warning/result transport; same 6 packed cases Independently repacked pre-fix producer: all 6 fail on the intended F3/F4 result-output assertion; bodies still execute. All 6 pass through Reflection/Rooting/ReflectionFree, with exact names/outcomes/IDs/output association.
Whole-feature ablation on reviewed current code Keep fixes/API/tests and replace only the maximum with TimeSpan.FromTicks(long.MaxValue); fresh full pack passes, then 4 adapter + 6 packaged assertions fail on missing warnings (2 adapter negative cases pass). Same selected cases pass using configured budgets.

Each RED runner exits 2 for actual assertion failures, with no skipped/zero-test
claim. Both pre-fix and current-code ablation use their own physical feeds and
fresh caches; six loaded consumer payload records per variant match the
corresponding packed DLLs. The current-code ablation patch SHA-256 is
D6BD1BE47A9FBEED628446E2D790B0003766A4F26A7E6899805281A650990DEE.

The same test bytes/assertions/selection are retained across comparisons.
Compiler/restore/PRI/XLF setup failures were excluded, not counted as RED.
Full commands, source/package/patch identities, independent discovery, executed
counts, assertion excerpts, and consumer provenance are preserved in the linked
decision record; raw machine-local logs and package caches were not uploaded.

Add opt-in method-level soft duration budgets, preserve final outcomes and retry semantics, and validate both hosts with packed consumers. Refs #12245.

Co-authored-by: Copilot App <[email protected]>
Contain warning and trace transport failures without replacing completed results or skipping cleanup. Preserve four fractional millisecond digits and add real runner-level fault regressions. Refs #12245.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 17:11
@github-actions github-actions Bot added the state/needs-review Awaiting review from the team. label Nov 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #12255

Compared merge base c67c555ad2e1e44683f7e492b735d39400d8af9b with head c801f3609450e84a6ce616cb82435586602f334e. Evidence applies to this head, not every intermediate commit.

Test-value evidence

All entries are static predictions. No tests were executed and no paired red/green execution records were available.

Contract Test and decisive assertion Counterfactual Evidence
Warn only when the reported duration is strictly greater than the budget TestMethodRunnerTests.ExecuteExpectedDuration_UsesStrictReportedDurationBoundary: exact warning list for budget-1, budget and budget+1 tick Changing <= to < warns at budget; changing it to < + 1 tick misses the above-budget row Static prediction: likely killed
Only Passed and Failed results are evaluated ExecuteExpectedDuration_DoesNotWarnForSkippedTimeoutOrInfrastructureResults: messages is empty for 9 outcomes Widening the outcome filter produces warnings Static prediction: likely killed
Superseded retry attempts are skipped ExecuteExpectedDuration_DoesNotWarnForSupersededAttempts: only the final attempt warns Dropping the IsSupersededRetryAttempt check adds warnings for attempts 1 and 2 Static prediction: likely killed
Warnings do not change outcome, exception or output ExecuteExpectedDuration_PreservesOutcomesExceptionsAndAuthoredOutput: outcome, exception, ids and output compared Overwriting TestContextMessages, or setting an outcome, fails Static prediction: likely killed
ReportExpectedDurationWarnings runs after retries are combined UnitTestRunnerTests in the changed range, plus the packaged [Retry] acceptance cases in ExpectedDurationTests Moving the call before CombineRetryAttempts would warn for superseded attempts Static prediction, not executed
Culture-sensitive number formatting ExecuteExpectedDuration_FormatsFractionalMillisecondsWithCurrentCulture: expects 123,4560 Using an invariant-culture format fails Static prediction: likely killed
Constructor rejects non-positive budgets ExpectedDurationAttributeTests.Constructor_NonPositiveMilliseconds_ThrowsArgumentOutOfRangeException: 0, -1 and int.MinValue Changing <= 0 to < 0 fails on 0 Static prediction: likely killed
The discovery cache includes ExpectedDurationAttribute Packaged acceptance tests with metadataMode cases Removing the entry would drop the metadata Static prediction, not executed
Resources, xlf, docs and PACKAGE.md Not applicable (non-executable) — —

Gap: the delivery-failure paths (DisplayMessage throwing, then the trace logger throwing) did not obviously have a dedicated unit test in the ranges I inspected. This is an evidence gap, not a defect.

🧵 Parallel safety

STATUS: PARTIAL. The parallel-safety-reviewer specialist task was not launched, so parallel-safety coverage is incomplete and must not be read as clean.

Manual observations on the changed tests (not a specialist result):

  • ExpectedDurationTests is marked [DoNotParallelize] for its shared generated asset.
  • The TestMethodRunnerTests culture mutations are restored in finally blocks.
  • There was no parallelization configuration change (config_count is 0).

Per-test assessment

Pseudo-mutation evidence is static prediction only, not executed mutation results. The grade-tests rubric skill was not formally run. These are manual assessments of the visible bodies. Production context was resolved from the diff.

Result Quality Test Notes How to improve
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_UsesStrictReportedDurationBoundary Exact boundary ticks and exact warning text are asserted. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_WithoutAttributeDoesNotWarnOrChangeOutput Asserts no warning and unchanged output. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_PreservesOutcomesExceptionsAndAuthoredOutput Many fields are asserted exactly, but the test is long. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_DoesNotWarnForSkippedTimeoutOrInfrastructureResults Nine non-eligible outcomes are covered. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_DoesNotWarnForSupersededAttempts Both within- and over-budget final attempts are covered. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_FormatsFractionalMillisecondsWithCurrentCulture The fr-FR decimal separator is asserted, and culture is restored. None
Pass A (90–100) new ExpectedDurationAttributeTests.Constructor_NonPositiveMilliseconds_ThrowsArgumentOutOfRangeException Boundary 0 plus negatives, with the parameter name. None
Uncertain — new UnitTestRunnerTests additions (lines 1105–1305) I did not read the bodies in detail. Review the bodies against RunSingleTestAsync ordering.
Uncertain — new ExpectedDurationTests (acceptance, 2 [TestMethod]) I did not grade the bodies in detail. They are marked [DoNotParallelize]. Grade the bodies, including the AcceptanceAssert.DurationPattern usage.

No inline findings were verified, and no duplicate-thread lookup was needed.

<sub>This advisory review is heuristic and non-blocking.

Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · ~32 AIC · ⌖ ~1 AIC · ⊞ 8K

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the opt-in expected-duration warning change.

No open issues 🎉

What changed in this PR

Adds opt-in MSTest [ExpectedDuration(milliseconds)] warnings for #12245, complementing the existing slowest-test ranking without introducing a new platform outcome or timeout mechanism.

Changes:

  • Adds a documented method-level duration budget and public API entries.
  • Evaluates final Passed/Failed results after retry selection, retaining warnings in result output and containing warning-delivery failures.
  • Adds boundary, failure-path, and packaged MTP/VSTest tests, plus resources and delivery documentation.

Test-value evidence: For head c801f3609450e84a6ce616cb82435586602f334e, the supplied record reports 86 passing tests and assertion failures against pre-fix and feature-disabled comparisons. These runs were not independently executed here; CI, Native AOT publishing, and hosted/IDE rendering remain documented validation gaps.

File Description
test/​UnitTests/​TestFramework.UnitTests/​Attributes/​ExpectedDurationAttributeTests.cs Tests rejection of nonpositive budgets.
test/​UnitTests/​MSTestAdapter.PlatformServices.UnitTests/​Execution/​UnitTestRunnerTests.cs Tests result and cleanup preservation when reporting fails.
test/​UnitTests/​MSTestAdapter.PlatformServices.UnitTests/​Execution/​TestMethodRunnerTests.cs Tests boundaries, exclusions, retries, formatting, and preserved output.
test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​ExpectedDurationTests.cs Tests packaged host warnings and per-result TRX associations across metadata modes.
src/​TestFramework/​TestFramework/​PublicAPI/​PublicAPI.Unshipped.txt Tracks the new attribute API.
src/​TestFramework/​TestFramework/​Attributes/​TestMethod/​ExpectedDurationAttribute.cs Defines and documents the duration-budget attribute.
src/​TestFramework/​TestFramework.Extensions/​PACKAGE.md Documents usage, timing boundaries, and advisory behavior.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.zh-Hant.xlf Adds Traditional Chinese catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.zh-Hans.xlf Adds Simplified Chinese catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.tr.xlf Adds Turkish catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.ru.xlf Adds Russian catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.pt-BR.xlf Adds Brazilian Portuguese catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.pl.xlf Adds Polish catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.ko.xlf Adds Korean catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.ja.xlf Adds Japanese catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.it.xlf Adds Italian catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.fr.xlf Adds French catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.es.xlf Adds Spanish catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.de.xlf Adds German catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​xlf/​Resource.cs.xlf Adds Czech catalog entries for new diagnostics.
src/​Adapter/​MSTestAdapter.PlatformServices/​Resources/​Resource.resx Defines budget warnings and delivery-failure messages.
src/​Adapter/​MSTestAdapter.PlatformServices/​InternalAPI/​InternalAPI.Unshipped.txt Tracks the internal warning-reporting method.
src/​Adapter/​MSTestAdapter.PlatformServices/​Execution/​UnitTestRunner.RunSingleTest.cs Invokes warning reporting after retry results are combined.
src/​Adapter/​MSTestAdapter.PlatformServices/​Execution/​TestMethodRunner.cs Compares budgets, appends warnings, and contains transport failures.
src/​Adapter/​MSTest.TestAdapter/​TestingPlatformAdapter/​MSTestDiscoveryCache.cs Includes the attribute in supported discovery-cache metadata.
docs/​decisions/​mstest-expected-duration.md Records design choices, comparisons, validation, and limitations.
docs/​Changelog.md Announces expected-duration warnings.

Review effort: Balanced

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
Address related review feedback with a using declaration and fixed-name Path.Join calls while preserving culture restoration, diagnostic containment, and test behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 17:39
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/approved Proposal approved; ready for implementation. labels Nov 6, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/approved Proposal approved; ready for implementation. labels Nov 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #12255

Compared merge base c67c555ad2e1e44683f7e492b735d39400d8af9b with head 64f835a0f43bb7575eeda0ec869aa170db50dd5e. Evidence applies to this head, not every intermediate commit.

Test-value evidence

All entries are static predictions. No paired execution records were inspected, and CI status is not treated as proof.

Contract Test / decisive assertion Counterfactual Result
Strict > boundary for budget and tick-level comparison TestMethodRunnerTests.ExecuteExpectedDuration_UsesStrictReportedDurationBoundary, which asserts the exact warning list and that below-budget and at-budget results keep their messages Changing > to >= or truncating to ms would warn on the at-budget case Likely killed (static)
No attribute means no warning ExecuteExpectedDuration_WithoutAttributeDoesNotWarnOrChangeOutput Warning without opt-in Likely killed (static)
Outcomes, exceptions and authored output are preserved, and only the warning is appended ExecuteExpectedDuration_PreservesOutcomesExceptionsAndAuthoredOutput, which makes exact multi-field assertions Overwriting the context messages or changing the outcome Likely killed (static)
Only Passed and Failed are evaluated ExecuteExpectedDuration_DoesNotWarnForSkippedTimeoutOrInfrastructureResults Dropping the outcome filter Likely killed (static)
Superseded retry attempts are skipped ExecuteExpectedDuration_DoesNotWarnForSupersededAttempts Dropping the IsSupersededRetryAttempt check Likely killed (static)
Current-culture formatting ExecuteExpectedDuration_FormatsFractionalMillisecondsWithCurrentCulture Invariant formatting Likely killed (static)
Warning-delivery and trace failures do not change results or cleanup UnitTestRunnerTests.RunSingleTestExpectedDuration_*PreservesResultsAndCleanup (5 cases) Removing the try/catch Likely killed (static)
Attribute constructor validation ExpectedDurationAttributeTests.Constructor_NonPositiveMilliseconds_ThrowsArgumentOutOfRangeException Allowing 0 or negative values Likely killed (static)
End-to-end MTP and VSTest reporting, including retry, data rows and metadata modes ExpectedDurationTests.Mtp_* and Vstest_* acceptance tests Warning not delivered or mis-associated Likely killed (static). Not executed here, and it needs -pack.
Docs, resx, xlf, PACKAGE.md, changelog Not applicable Non-executable n/a

🧵 Parallel safety

STATUS: PARTIAL. The parallel-safety specialist task was not run, so coverage is incomplete and this is not a clean result. In the changed code, the acceptance class ExpectedDurationTests is marked [DoNotParallelize] because it shares one generated asset. The unit tests restore CultureInfo.CurrentCulture and CurrentUICulture in finally blocks.

Per-test assessment

Pseudo-mutation evidence above is static prediction, not executed mutation results.

Result Quality Test Notes How to improve
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_UsesStrictReportedDurationBoundary Exact tick-level boundary and warning-list assertions. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_PreservesOutcomesExceptionsAndAuthoredOutput Exact multi-field and message assertions. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_DoesNotWarnForSupersededAttempts Covers both the within-budget and over-budget final attempt. None
Pass B (80–89) new TestMethodRunnerTests.ExecuteExpectedDuration_WithoutAttributeDoesNotWarnOrChangeOutput Narrow, exact no-opt-in check. None
Pass B (80–89) new TestMethodRunnerTests.ExecuteExpectedDuration_DoesNotWarnForSkippedTimeoutOrInfrastructureResults A loop over outcomes with exact empty-message assertions. None
Pass B (80–89) new TestMethodRunnerTests.ExecuteExpectedDuration_FormatsFractionalMillisecondsWithCurrentCulture Asserts the fr-FR decimal separator exactly. None
Pass B (80–89) new UnitTestRunnerTests.RunSingleTestExpectedDuration_IOExceptionPreservesResultsAndCleanup Shared helper asserts results and cleanup. None
Pass B (80–89) new UnitTestRunnerTests.RunSingleTestExpectedDuration_OperationCanceledExceptionPreservesResultsAndCleanup Shared helper asserts results and cleanup. None
Pass B (80–89) new UnitTestRunnerTests.RunSingleTestExpectedDuration_HostExceptionPreservesResultsAndCleanup Shared helper asserts results and cleanup. None
Pass B (80–89) new UnitTestRunnerTests.RunSingleTestExpectedDuration_TraceFailurePreservesResultsAndCleanup Covers the nested trace-failure path. None
Pass B (80–89) new UnitTestRunnerTests.RunSingleTestExpectedDuration_ThrowingExceptionMessagePreservesResultsAndCleanup Covers an exception whose message throws. None
Pass B (80–89) new ExpectedDurationAttributeTests.Constructor_NonPositiveMilliseconds_ThrowsArgumentOutOfRangeException Boundary validation. None
Pass B (80–89) new ExpectedDurationTests.Mtp_ExpectedDuration_PreservesWarningsAndResultAssociations Long process-level body, which is acceptable for integration tests. None
Pass B (80–89) new ExpectedDurationTests.Vstest_ExpectedDuration_PreservesWarningsAndResultAssociations Checks TRX result-to-test associations. None

No inline findings. No verified, actionable defects were found, so no inline comments were posted.

<sub>This advisory review is heuristic and non-blocking.

Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · ~27 AIC · ⌖ ~1 AIC · ⊞ 8K

@microsoft-github-policy-service microsoft-github-policy-service Bot added the state/needs-review Awaiting review from the team. label Nov 6, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Nov 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The opt-in expected-duration warning change has no active review issues requiring resolution.

No open issues 🎉

Review effort: Balanced

@microsoft-github-policy-service microsoft-github-policy-service Bot added the state/needs-review Awaiting review from the team. label Nov 6, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Nov 6, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 6, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Nov 6, 2026
Expand the leaf-result collection expression and add its trailing comma to satisfy SA1500 and SA1413 without changing the report assertions.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 18:07
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/approved Proposal approved; ready for implementation. labels Nov 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧪 Test quality review — PR #12255

Compared merge base c67c555ad2e1e44683f7e492b735d39400d8af9b with head 4502313dccf9ffd5fd8b12127b96a2ebd7bf739e. Evidence applies to this head, not every intermediate commit.

Test-value evidence

All entries are static predictions. No tests were executed here. The PR description reports paired red/green runs, but for the earlier head c801f36. The two later commits touched only ExpectedDurationTests.cs and TestMethodRunnerTests.cs, which makes the executed evidence for this exact head unverified.

Contract Test and decisive assertion Counterfactual Evidence
Warn only when the reported duration is strictly over budget ExecuteExpectedDuration_UsesStrictReportedDurationBoundary: warning present above the budget, absent at or below it Change <= to < or ignore the budget Predicted detected
Opt-in only (no attribute, no warning) ExecuteExpectedDuration_WithoutAttributeDoesNotWarnOrChangeOutput Always warn Predicted detected
Outcomes and authored output are preserved ExecuteExpectedDuration_PreservesOutcomesExceptionsAndAuthoredOutput Overwrite outcome or TestContextMessages Predicted detected
Skipped, timeout and infrastructure results are excluded ExecuteExpectedDuration_DoesNotWarnForSkippedTimeoutOrInfrastructureResults Drop the outcome filter Predicted detected
Superseded retry attempts are excluded ExecuteExpectedDuration_DoesNotWarnForSupersededAttempts; acceptance RetryFinishesWithinBudget / RetryFinishesOverBudget Drop the IsSupersededRetryAttempt check Predicted detected
Culture-aware formatting ExecuteExpectedDuration_FormatsFractionalMillisecondsWithCurrentCulture Use invariant culture Predicted detected
Delivery or trace failures cannot alter results or cleanup Five RunSingleTestExpectedDuration_*PreservesResultsAndCleanup tests Remove the try/catch Predicted detected
Attribute ctor validation ExpectedDurationAttributeTests.Constructor_NonPositiveMilliseconds_ThrowsArgumentOutOfRangeException Allow 0 or negative values Predicted detected
MTP/VSTest transport, rows and TRX association Acceptance Mtp_/Vstest_ExpectedDuration_PreservesWarningsAndResultAssociations in 3 metadata modes Skip the warning Predicted detected
Discovery-cache attribute registration (MSTestDiscoveryCache) Acceptance metadata modes (ReflectionFree/Rooting) Remove the type from the list Predicted detected
Docs, resx, xlf, PublicAPI n/a n/a Not applicable (non-behavioral)

🧵 Parallel safety

STATUS: CLEAN. No findings.

Test assembly Scope Notes
MSTest.Acceptance.IntegrationTests Method-level The ExpectedDurationTests class is [DoNotParallelize] for its shared generated asset.
MSTestAdapter.PlatformServices.UnitTests Not determined Culture changes are restored in finally.
TestFramework.UnitTests Not examined Only a pure ctor test changed.

The specialist ran by reading the diff only, so the unit-test assemblies' parallel scope was not fully determined.

Per-test assessment

Pseudo-mutation evidence below consists of static predictions, not executed mutation results. Grades are summarized per group, covering new tests only. Existing threads and previous reviews were consulted, and no novel actionable finding passed the publication gate.

Result Quality Test Notes How to improve
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_UsesStrictReportedDurationBoundary Exact boundary assertions on warnings. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_PreservesOutcomesExceptionsAndAuthoredOutput Outcome, exception and output checked. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_DoesNotWarnForSkippedTimeoutOrInfrastructureResults Covers the excluded outcomes. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_DoesNotWarnForSupersededAttempts Final-attempt-only contract asserted. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_FormatsFractionalMillisecondsWithCurrentCulture Culture-specific text asserted. None
Pass A (90–100) new TestMethodRunnerTests.ExecuteExpectedDuration_WithoutAttributeDoesNotWarnOrChangeOutput Negative control. None
Pass A (90–100) new UnitTestRunnerTests.RunSingleTestExpectedDuration_*PreservesResultsAndCleanup (5 cases) Results and cleanup asserted under delivery faults. None
Pass B (80–89) new ExpectedDurationAttributeTests.Constructor_NonPositiveMilliseconds_ThrowsArgumentOutOfRangeException Loop over 0, -1, int.MinValue; no positive-value control. None
Pass A (90–100) new ExpectedDurationTests.Mtp_ExpectedDuration_PreservesWarningsAndResultAssociations Asserts names, outcomes and output association. None
Pass A (90–100) new ExpectedDurationTests.Vstest_ExpectedDuration_PreservesWarningsAndResultAssociations Same contract through the VSTest host. None

<sub>This advisory review is heuristic and non-blocking.

Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · ~44 AIC · ⌖ ~1 AIC · ⊞ 8K

@microsoft-github-policy-service microsoft-github-policy-service Bot added the state/needs-review Awaiting review from the team. label Nov 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the opt-in expected-duration warning change.

No open issues 🎉

Review effort: Balanced

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.

Add opt-in expected-duration warnings to MSTest tests

3 participants