Skip to content

Speed up slowest acceptance tests and add --no-build consistently#15471

Open
nohwnd wants to merge 3 commits intomicrosoft:mainfrom
nohwnd:speed-up-slowest-acceptance-tests
Open

Speed up slowest acceptance tests and add --no-build consistently#15471
nohwnd wants to merge 3 commits intomicrosoft:mainfrom
nohwnd:speed-up-slowest-acceptance-tests

Conversation

@nohwnd
Copy link
Copy Markdown
Member

@nohwnd nohwnd commented Mar 10, 2026

Summary

Addresses #15468 — analyzed the slowest acceptance tests from a net48_x86 TRX run and applied targeted optimizations.

Changes

Performance optimizations

  • HangDumpChildProcesses: Reduced TestTimeout from 15s to 10s. The child processes hang immediately via Thread.Sleep(30_000), so 10s is ample margin (the simpler HangDumpOnTimeout test already uses 3s). Saves ~5s per parameterization (~10s total).
  • RunSettingsAreLoadedFromProject: Added --no-build to the second InvokeDotnetTest call. The project is already built by the first call; the second only changes runsettings (a test-execution concern, not a build concern). Saves ~10-15s per parameterization (~20-30s total).

Consistency

  • Standardized --no-build placement to always be right after the path argument in all InvokeDotnetTest calls across DotnetTestTests.cs, DotnetTestMSBuildOutputTests.cs, and RunsettingsTests.cs.
  • Removed now-unused using Microsoft.TestPlatform.TestUtilities from DotnetTestMSBuildOutputTests.cs.

Tooling

  • Added trx-analysis skill (.github/skills/trx-analysis/SKILL.md) with reusable PowerShell queries for parsing TRX files: slowest tests, most-executed tests, failure analysis, etc.

Top 10 slowest tests (from TRX analysis)

Sec Test Optimization
49.4 HangDumpChildProcesses (net9.0) Reduced timeout 15s to 10s
48.3 HangDumpChildProcesses (net8.0) Same
34.0 RunTests (XUnit10kPassing) Perf benchmark by design
33.2 RunTestsWithDefaultAdaptersSkipped (XUnit10kPassing) Perf benchmark by design
31.7 RunSettingsAreLoadedFromProject (net8.0) Added --no-build on 2nd call
30.0 RunDotnetTestWithCsprojPassInlineSettings Single dotnet test call
29.9 RunSettingsAreLoadedFromProject (net462) Same
28.1 BlameDataCollectorShouldOutputDumpFile Crash dump collection
26.1 MSBuildLoggerCanBeDisabledByBuildProperty Single dotnet test call
24.9 MSBuildLoggerCanBeEnabledByBuildProperty Single dotnet test call

Estimated total savings: ~30-40s across affected parameterizations.

Also filed #15470 for the broader issue of over-parameterized tests (e.g. RunTestsFromMultipleMSTestAssemblies runs 140 times).

- Reduce HangDumpChildProcesses TestTimeout from 15s to 10s (saves ~5s per
  parameterization). The child processes hang immediately, so 10s is plenty.
- Add --no-build to second InvokeDotnetTest call in RunSettingsAreLoadedFromProject
  to skip redundant rebuild when only runsettings change.
- Standardize --no-build placement right after the path argument in all
  InvokeDotnetTest calls for consistency.
- Remove unused using directive in DotnetTestMSBuildOutputTests.cs.
- Add trx-analysis skill for parsing TRX test result files.

Fixes microsoft#15468

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 10, 2026 09:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the slowest acceptance tests by reducing timeouts and adding --no-build flags to avoid redundant builds, while also standardizing argument ordering and removing an unused using directive.

Changes:

  • Reduced HangDumpChildProcesses TestTimeout from 15s to 10s to save ~10s total.
  • Added --no-build to InvokeDotnetTest calls across multiple test files and removed PackageVersion MSBuild property from those calls.
  • Added a new .github/skills/trx-analysis/SKILL.md with PowerShell TRX analysis queries.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
RunsettingsTests.cs Adds --no-build to both InvokeDotnetTest calls and removes PackageVersion property
DotnetTestTests.cs Adds --no-build to all InvokeDotnetTest calls and removes PackageVersion property
DotnetTestMSBuildOutputTests.cs Adds --no-build, removes PackageVersion property and unused using
BlameDataCollectorTests.cs Reduces hang dump TestTimeout from 15s to 10s
.github/skills/trx-analysis/SKILL.md New skill file with reusable PowerShell TRX analysis queries

nohwnd and others added 2 commits March 10, 2026 10:39
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants