Repository navigation
Reduce redundant acceptance test preparation - #12197
Conversation
Avoid creating an abandoned temporary root for owned assets, prepare only consumed TFMs in the ANSI and assembly-cleanup fixtures, and add asset ownership regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🧪 Test quality review — PR #12197
Compared merge base d9e38dc463365dc12f714db14815b46dedb0ed15 with head 98ecc720fc67e63c281af8712170185b84853eb4. Evidence applies to this head, not every intermediate commit. No inline findings. Duplicate-report lookup was not performed.
Test-value evidence
Nothing was executed in this review. The results below are static predictions, plus the PR author's own claims, which I have not verified.
| Contract | Test and decisive assertion | Counterfactual | Evidence |
|---|---|---|---|
TestAsset(name, code) owns only one root, with no abandoned temp root. |
GenerateAssetAsync_WithoutDirectory_PreparesOnlyTheOwnedRoot: Assert.HasCount(1, preparedRoots). |
Restoring the : this(assetName, assetCode, new TempDirectory(null)) delegation creates a second root containing the asset directory, so the count would be 2. |
Static prediction: would fail on the old code and pass on the fix. The PR claims an executed red/green run (expected 1, actual 2). That run is not independently verifiable here. |
| Same-name owned assets stay independent. | GenerateAssetAsync_WithSameName_KeepsAssetsIndependent: distinct paths, and contents first / second. |
Sharing one root would collide or overwrite. | Static prediction. The test is a control that passes before and after. |
A borrowed directory is not deleted on Dispose. |
Dispose_WithBorrowedDirectory_LeavesCallerOwnedFiles: Caller.txt and Data.txt remain after Dispose. |
Disposing the caller's directory would delete both files. | Static prediction. The test is a control that passes before and after. |
ANSI and assembly-cleanup fixtures prepare only NetCurrent. |
Existing tests all call LocateFrom(..., TargetFrameworks.NetCurrent). |
A consumed-TFM mismatch would fail at host location. | Refactor, expected green before and after. I checked that the static consumers use NetCurrent. The author reports 97 existing cases passing before and after. |
Gap: no accessible execution records were available to me. The numbers above come from the PR description.
🧵 Parallel safety
STATUS: CLEAN (counts all 0).
| Assembly | Scope |
|---|---|
| Microsoft.Testing.Platform.Acceptance.IntegrationTests | MethodLevel, all cores. |
| MSTest.Acceptance.IntegrationTests | The changed file was treated as in scope, but no parallelization attribute changed. Settings were not inspected. |
TestAssetTests uses GUID-suffixed asset names, so enumerating TestSuiteDirectory can only match its own root. No findings.
Per-test assessment
Pseudo-mutation evidence below consists of static predictions, not executed mutation results.
<table>
<thead>
<tr><th>Result</th><th>Quality</th><th>Test</th><th>Notes</th><th>How to improve</th></tr>
</thead>
<tbody>
<tr>
<td>Pass</td>
<td>A (90–100)</td>
<td>new <code>TestAssetTests.<br>GenerateAssetAsync_<br>WithoutDirectory_<br>PreparesOnlyTheOwnedRoot</code></td>
<td>Asserts exactly one prepared root, the path, the id, the contents and the NuGet.config.</td>
<td>None</td>
</tr>
<tr>
<td>Pass</td>
<td>B (80–89)</td>
<td>new <code>TestAssetTests.<br>GenerateAssetAsync_<br>WithSameName_<br>KeepsAssetsIndependent</code></td>
<td>Distinct paths and per-asset contents are verified.</td>
<td>None</td>
</tr>
<tr>
<td>Pass</td>
<td>B (80–89)</td>
<td>new <code>TestAssetTests.<br>Dispose_<br>WithBorrowedDirectory_<br>LeavesCallerOwnedFiles</code></td>
<td>Caller and asset files survive disposal.</td>
<td>None</td>
</tr>
</tbody>
</table>
The modified fixtures in AssemblyCleanupTests and AnsiOptionTests contain no changed test methods, so they are not graded.
<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 · ~47 AIC · ⌖ ~1 AIC · ⊞ 8K
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the targeted reduction in redundant acceptance-test preparation.
No open issues 🎉
What changed in this PR
This PR reduces redundant acceptance-test preparation in the shared test infrastructure without changing the existing execution matrix or assertions.
Changes:
- Removes constructor delegation that creates an abandoned temporary asset root.
- Limits ANSI and assembly-cleanup fixture preparation to the
NetCurrentframework their tests execute. - Adds regressions for single-root preparation, independent same-name assets, and borrowed-directory ownership.
Test-value evidence: For revision 98ecc720, the PR reports the new root-count regression failing before the fix and passing afterward, plus all 97 existing selected cases passing on both states. Execution artifacts were not independently inspected; cross-platform and full-suite validation remain outside the reported local run.
| File | Description |
|---|---|
test/Utilities/Microsoft.Testing.TestInfrastructure/TestAsset.cs |
Removes redundant temporary-root creation. |
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/AssemblyCleanupTests.cs |
Prepares only the framework consumed by the test. |
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TestAssetTests.cs |
Adds preparation and ownership regression tests. |
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/AnsiOptionTests.cs |
Restricts fixture preparation to NetCurrent. |
Review effort: Balanced
Pull request
Summary
Acceptance setup was creating a temporary asset root that was immediately abandoned, and two fixtures were compiling target frameworks that none of their assertions executed.
Remove the unused constructor delegation in
TestAssetand limit the ANSI and assembly-cleanup fixtures to theNetCurrentTFM they consume. Add regressions for a single owned preparation root, independent same-name assets, and borrowed-directory ownership. No existing test, data row, launch or assertion is removed.Design and decision record
This is a bounded test-infrastructure fix, not a new feature requiring a separate design record. The consumer inventory showed that every ANSI and assembly-cleanup assertion launches only
NetCurrentin Release/reflection mode. Both their reflection and default Rooting source-generation builds remain.Keep the existing fixture lifetime, private mutable assets, fresh per-assembly package caches, compiler sharing and method-level parallel scheduling. Do not introduce global build caching or merge the four materially different Runner scenarios.
Demonstration
Measured with the same 97 existing acceptance cases, using generated-root inventories and complete child binlogs:
All 80 Runner combinations remain: five TFMs x Debug/Release x build/publish x four scenarios. These measurements use the full local Windows matrix; CI's
FastAcceptanceTest=truematrix starts smaller. No wall-time speedup is claimed from a single noisy comparison. Media is not applicable because product output/layout is unchanged.Validation and regression proof
Validated source bytes are committed as
98ecc720fc67e63c281af8712170185b84853eb4; execution occurred before committing, with all four files verified byte-for-byte unchanged afterward. Baseline:d9e38dc463365dc12f714db14815b46dedb0ed15.Windows x64, pinned SDK
12.0.100-alpha.1.26509.101, Release/net12.0 outer hosts..\build.cmd -pack -c Release -blpassed on both source states, exit 0, with 0 warnings/errors. An intermediate pack exhausted local disk space; the unchanged retry passed after owned cleanup.Executed test commands from the worktree root, with equivalent fresh output paths below instead of the original machine-specific locations:
The first two selectors also passed before the changes (16 + 81, using
--no-buildafter the baseline pack). Final commands rebuilt the affected projects. Final totals: 101 passing executions / 100 distinct cases, because the existing encoding control is intentionally repeated in the helper selection. Independent native-SDK discovery reconciled 19 MTP and 81 MSTest cases. Fresh TRX identities/counters passed the repository execution verifier; JUnit and CTRF exports also parsed with matching counts.Generated consumers used the real Release packages: MTP
2.6.0-devand MSTest4.6.0-dev. The relevant platform/framework/adapter/source-generation archives were byte-identical across states; 382 baseline and 350 final physical consumer DLL copies matched their exact archive payloads. Raw local reports/binlogs and package/source manifests are retained but are not publicly uploaded; the observable results are summarized here.Full-suite CI, Linux/macOS, and unrelated native AOT/ReflectionFree/platform-specific runtime tests were not run locally; their source and mode matrices are unchanged. Rooting preparation in the two changed fixtures is compile proof, not a claim that those fixtures execute source-generated metadata.
Test-value evidence
GenerateAssetAsync_WithoutDirectory_PreparesOnlyTheOwnedRootAssert.HasCount(1, preparedRoots)failed, expected 1 / actual 2. Same helper selector above with--no-buildafter compiling the additive tests: exit 2, 3 passed / 1 failed / 0 skipped.GenerateAssetAsync_WithSameName_KeepsAssetsIndependentandDispose_WithBorrowedDirectory_LeavesCallerOwnedFilespassed, checking distinct paths/contents and post-disposal caller files.