Fix test property lifecycle scope - #10080
Conversation
Keep per-test traits, categories, and TCM properties out of assembly and class lifecycle contexts while preserving downward flow from assembly and class initialization. Fixes #10041 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 872b37f5-a59d-4cde-a730-df6c766ef8a7
There was a problem hiding this comment.
Pull request overview
Separates per-test metadata from assembly/class lifecycle properties, preventing property leakage between sibling tests while preserving initializer property flow.
Changes:
- Adds distinct per-test and lifecycle property dictionaries.
- Uses lifecycle-only properties for assembly/class initialization and cleanup.
- Adds unit and acceptance regression coverage across the complete test lifecycle.
Show a summary per file
| File | Description |
|---|---|
TestExecutionManagerTests.cs |
Tests TCM property isolation across lifecycle contexts and sibling tests. |
TestContextPropertyFlowTests.cs |
Adds end-to-end property-scope coverage. |
InternalAPI.Unshipped.txt |
Tracks the new internal runner overloads. |
UnitTestRunner.TestFilter.cs |
Uses lifecycle properties during filtered-test cleanup. |
UnitTestRunner.RunSingleTest.cs |
Separates test and lifecycle property inputs. |
TestExecutionManager.Runner.cs |
Seeds and passes source-only lifecycle properties. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Medium
🧪 Test quality grade — PR #10080
This advisory comment was generated automatically. Grades are heuristic Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
/backport to rel/4.3 |
|
Started backporting to rel/4.3: https://github.com/microsoft/testfx/actions/runs/29831531182 |
|
Amaury Levé (@Evangelink) backporting to rel/4.3 failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Fix test property lifecycle scope
Using index info to reconstruct a base tree...
M src/Adapter/MSTestAdapter.PlatformServices/Execution/TestExecutionManager.Runner.cs
M src/Adapter/MSTestAdapter.PlatformServices/Execution/UnitTestRunner.RunSingleTest.cs
M src/Adapter/MSTestAdapter.PlatformServices/Execution/UnitTestRunner.TestFilter.cs
A src/Adapter/MSTestAdapter.PlatformServices/InternalAPI/InternalAPI.Unshipped.txt
M test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Execution/TestExecutionManagerTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Adapter/MSTestAdapter.PlatformServices/Execution/TestExecutionManager.Runner.cs
CONFLICT (content): Merge conflict in src/Adapter/MSTestAdapter.PlatformServices/Execution/TestExecutionManager.Runner.cs
Auto-merging src/Adapter/MSTestAdapter.PlatformServices/Execution/UnitTestRunner.RunSingleTest.cs
CONFLICT (content): Merge conflict in src/Adapter/MSTestAdapter.PlatformServices/Execution/UnitTestRunner.RunSingleTest.cs
Auto-merging src/Adapter/MSTestAdapter.PlatformServices/Execution/UnitTestRunner.TestFilter.cs
CONFLICT (content): Merge conflict in src/Adapter/MSTestAdapter.PlatformServices/Execution/UnitTestRunner.TestFilter.cs
CONFLICT (modify/delete): src/Adapter/MSTestAdapter.PlatformServices/InternalAPI/InternalAPI.Unshipped.txt deleted in HEAD and modified in Fix test property lifecycle scope. Version Fix test property lifecycle scope of src/Adapter/MSTestAdapter.PlatformServices/InternalAPI/InternalAPI.Unshipped.txt left in tree.
Auto-merging test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Execution/TestExecutionManagerTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix test property lifecycle scope
Error: The process '/usr/bin/git' failed with exit code 128NOTE: A PR will be created, but needs to be revised manually! |
…to rel/4.3) (#10110) Co-authored-by: Amaury Levé <amauryleve@microsoft.com>
Summary
[TestProperty], test categories, and host-provided TCM properties scoped to the individual test lifecycleAssemblyInitializeandClassInitializeValidation
MSTestAdapter.PlatformServices.UnitTests: 925 passedTestContextPropertyFlowTests: 6 passed across net462, net8.0, and net10.0Fixes #10041