Skip to content

Add MSTest.Windows.AppTesting for desktop UI tests - #10862

Open
Amaury Levé (Evangelink) wants to merge 14 commits into
mainfrom
dev/amauryleve/mstest-ui-testing
Open

Add MSTest.Windows.AppTesting for desktop UI tests#10862
Amaury Levé (Evangelink) wants to merge 14 commits into
mainfrom
dev/amauryleve/mstest-ui-testing

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

Revives the unmerged work from #7810 on current main.

  • add the MSTest.Windows.AppTesting package with application lifecycle and Windows UI Automation base classes
  • expose it through MSTest.Sdk with <EnableWindowsAppTesting>true</EnableWindowsAppTesting> for MTP and VSTest
  • add a deterministic Character Map sample and acceptance coverage
  • update the implementation for current SDK packing, NuGet metadata, and MSTest.TestFramework dependency conventions

Validation

  • build.cmd -pack
  • WindowsAppTestingSdkTests: 4 passed across MTP and VSTest (net8.0-windows and net10.0-windows)

Supersedes #7810.

Revive the MSTest.Windows.AppTesting work from PR #7810 on current main, including SDK integration, package metadata, a deterministic sample, and MTP/VSTest acceptance coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI balanced review requested due to automatic review settings August 29, 2026 08:42
@Evangelink
Amaury Levé (Evangelink) enabled auto-merge (squash) August 29, 2026 08:44
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10862

GradeTestMutationNotesHow to improve
B (80–89) new CharacterMapTests.
CharacterMap_
MainWindow_
HasTitle
N/A Demo sample test; checks non-empty title but not a specific expected value. If a known app title is deterministic, assert the exact expected string.
B (80–89) new CharacterMapTests.
CharacterMap_
MainWindow_
IsVisible
N/A Demo sample illustrating WindowTest usage; asserts control type only. Could also assert MainWindow.Current.IsEnabled/IsOffscreen for a stronger visibility check.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingMSTestRunner_
RunsDesktopTests
N/A Follows established acceptance-test pattern (mirrors PlaywrightSdkTests); asserts exit code and exact pass/fail/skip counts, correctly gated by OSCondition for Windows-only desktop UI automation.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingVSTest_
RunsDesktopTests
N/A Verifies both VSTest engine banner and exact passed/failed/skipped summary line for the VSTest path.

Note: Mutation analysis reported N/A for all four tests — the acceptance tests spawn out-of-process test hosts against a Windows-only physical UI (Character Map), and the sample tests are documentation demos, so the production entry points (native app automation) could not be resolved/exercised for pseudo-mutation in this review. All four tests are gated correctly ([OSCondition(OperatingSystems.Windows, ...)] on the acceptance tests) and follow the repo's existing SDK-acceptance-test conventions (TestAssetFixture, DynamicData over TargetFrameworks, AssertOutputContainsSummary/AssertOutputContains) closely, matching sibling files like PlaywrightSdkTests.cs. No high-confidence actionable findings warranted an inline suggestion.

This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Suggestions on the Files changed tab can be applied with one click. Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 47.6 AIC · ⌖ 1.12 AIC · ⊞ 16.9K · [◷]( · )

@github-actions

This comment has been minimized.

@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.

Note

🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.

Review Summary — MSTest.Windows.AppTesting

Clean PR that adds a new MSTest.Windows.AppTesting package with application lifecycle and Windows UI Automation base classes, wired through MSTest.Sdk. Two inline comments posted; neither is blocking.

# Dimension Verdict
1 Algorithmic Correctness ✅ OK — startup loop handles edge cases (process exit, timeout) correctly
2 Threading & Concurrency ⚠️ Minor — AutomationTest uses [TestClass] (MTA) while subclasses use [STATestClass]; see inline comment
3 Security & IPC ✅ N/A
4 Public API & Binary Compat ✅ OK — all public API in PublicAPI.Unshipped.txt, no init accessors, types unsealed by design (base-class hierarchy), XML docs present
5 Performance & Allocations ✅ OK — not a hot path
6 Cross-TFM Compatibility ✅ OK — targets net8.0-windows / net9.0-windows only, validated in .targets
7 Resource & IDisposable ✅ OK — Process disposed in finally; CloseMainWindowKill cascade is correct
8 Defensive Coding ✅ OK — boundary checks for process exit, null handle, and timeout present
9 Naming & Code Style ✅ OK
10 Logging & Observability ✅ N/A
11 Error Messages & UX ✅ OK — clear exception messages with variable names
12 Tests & Test Quality ✅ OK — acceptance tests cover MTP and VSTest, OS-gated
13 Documentation ✅ OK — PACKAGE.md present, XML docs thorough
14 Localization ✅ N/A — no user-facing resx strings
15 Backward Compatibility ✅ N/A — new package
16 Build & Pack Integration ✅ OK — verify-nupkgs.ps1 updated, MSBuild integration mirrors Aspire/Playwright patterns
17 Serialization ✅ N/A
18 Tracing & Telemetry ✅ N/A
19 Nullability ✅ OK — null! used for lifecycle-initialized properties, consistent with rest of codebase
20 TODOs & Leftovers ✅ None found
21 Scope Discipline ✅ Single concern
22 Script & Tooling Hygiene ✅ OK — PowerShell hash table update is correct

Overall: Looks good. The two inline comments are non-blocking suggestions for future hardening.

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.

Copilot review overview

Review tier: Balanced
Findings: 2 Medium severity · 2 Low severity

New issues introduced by this change (4)
Severity Finding
Medium severity samples/​public/​DemoMSTestSdk/​ProjectUsingWindowsAppTesting/​ProjectUsingWindowsAppTesting.csproj — This project is not listed in samples/public/DemoMSTestSdk/DemoMSTestSdk.sln. Because…
Medium severity samples/​public/​DemoMSTestSdk/​ProjectUsingWindowsAppTesting/​ProjectUsingWindowsAppTesting.csproj — The non-SDK example cannot restore as written: MSTestWindowsAppTestingVersion is only defined by…
Low severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — No test exercises this validation path: every generated acceptance TFM appends -windows. Add a…
Low severity src/​TestFramework/​TestFramework.Windows.AppTesting/​ApplicationTest.cs — The acceptance tests exercise only a responsive Character Map process. Add coverage for an app that…
What changed in this PR

Adds Windows desktop UI automation support to MSTest through a new package, SDK integration, sample, and acceptance coverage.

Changes:

  • Adds application lifecycle and UI Automation base classes.
  • Integrates the package into MSTest.Sdk for MTP and VSTest.
  • Adds Character Map samples, acceptance tests, and package verification.
File Description
TestFx.slnx Includes the new package project.
WindowsAppTestingSdkTests.cs Tests MTP and VSTest integration.
WindowTest.cs Exposes the main UI Automation window.
TestFramework.Windows.AppTesting.csproj Defines the Windows package.
PublicAPI.Unshipped.txt Tracks new public APIs.
PublicAPI.Shipped.txt Initializes the shipped baseline.
PACKAGE.md Documents package usage.
GlobalUsings.cs Imports MSTest APIs globally.
AutomationTest.cs Adds the hierarchy root.
ApplicationTest.cs Manages application lifecycle.
VSTest.targets Enables the feature under VSTest.
Sdk.props.template Defines feature and version properties.
NativeAOT.targets Rejects unsupported NativeAOT usage.
ClassicEngine.targets Enables the feature under MTP.
WindowsAppTesting.targets Adds validation, package reference, and using.
MSTest.Sdk.csproj Packs and versions the feature target.
ProjectUsingWindowsAppTesting.csproj Adds the SDK sample configuration.
CharacterMapTests.cs Demonstrates desktop UI tests.
verify-nupkgs.ps1 Verifies package contents.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Package/MSTest.Sdk/Sdk/Features/WindowsAppTesting.targets
Run the base hierarchy on STA threads, honor cooperative cancellation during app startup, include the package in MSTest.slnf, and make package verification detect missing outputs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI review requested due to automatic review settings August 29, 2026 10:31
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10862

Reviewed 4 new test methods introduced by this PR across the new TestFramework.Windows.AppTesting sample and its acceptance test. All four are focused, single-behavior tests with meaningful equality/non-empty assertions on the exercised contract (ControlType, window Name, process exit code, and MSTest/VSTest summary counts), correctly awaited async work, and no anti-pattern findings. No high-confidence actionable issues were found, so no inline suggestions were posted.

GradeTestMutationNotesHow to improve
A (90–100) new CharacterMapTests.
CharacterMap_
MainWindow_
IsVisible
0/0 (no meaningful points) Single meaningful equality assertion on ControlType; behavior is thin OS-automation plumbing with no internal branch logic to mutate.
A (90–100) new CharacterMapTests.
CharacterMap_
MainWindow_
HasTitle
0/0 (no meaningful points) Clear non-empty-title assertion with a descriptive failure message.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingMSTestRunner_
RunsDesktopTests
N/A End-to-end acceptance test asserting exit code and exact pass/fail/skip summary against a generated real project.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingVSTest_
RunsDesktopTests
N/A Verifies exit code and VSTest-specific summary output; async call correctly awaited.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 66.8 AIC · ⌖ 1.12 AIC · ⊞ 16.9K · [◷]( · )

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.

Copilot review overview

Review tier: Balanced
Findings: 3 Medium severity · 3 Low severity

New issues introduced by this change (2)
Severity Finding
Medium severity test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​WindowsAppTestingSdkTests.cs — This VSTest leg omits the roll-forward setting used by the MTP leg above. The repo-local toolchain…
Low severity src/​Package/​MSTest.Sdk/​Sdk/​Sdk.props.template — These new user-facing SDK properties are missing from the SDK documentation tables.…
Pre-existing issues (4)
Severity Finding
Medium severity samples/​public/​DemoMSTestSdk/​ProjectUsingWindowsAppTesting/​ProjectUsingWindowsAppTesting.csproj — The non-SDK example cannot restore as written: MSTestWindowsAppTestingVersion is only defined by… View comment
Medium severity samples/​public/​DemoMSTestSdk/​ProjectUsingWindowsAppTesting/​ProjectUsingWindowsAppTesting.csproj — This project is not listed in samples/public/DemoMSTestSdk/DemoMSTestSdk.sln. Because… View comment
Low severity src/​TestFramework/​TestFramework.Windows.AppTesting/​ApplicationTest.cs — The acceptance tests exercise only a responsive Character Map process. Add coverage for an app that… View comment
Low severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — No test exercises this validation path: every generated acceptance TFM appends -windows. Add a… View comment
Suppressed comments (3)

samples/public/DemoMSTestSdk/ProjectUsingWindowsAppTesting/ProjectUsingWindowsAppTesting.csproj:1

  • This public sample is not included in samples/public/DemoMSTestSdk/DemoMSTestSdk.sln. eng/build-samples.ps1:60-64 builds discovered solutions rather than standalone projects, so the new sample is currently omitted from sample CI and can silently break. Add the project and its Debug/Release configurations to that solution.
<Project Sdk="MSTest.Sdk">

src/Package/MSTest.Sdk/Sdk/Features/WindowsAppTesting.targets:11

  • The added acceptance asset always targets *-windows, and no other test exercises this validation message, so removing or breaking this target would leave all current tests green. Add a non-Windows-target build case that enables the feature and asserts this diagnostic.
  <Target Name="_ValidateWindowsAppTestingPlatform" BeforeTargets="Restore;Build"
          Condition=" '$(TargetFramework)' != '' and '$(_IsWindowsTfm)' != 'true' ">
    <Error Text="MSTest.Windows.AppTesting requires a Windows target framework (e.g. net8.0-windows). Current TargetFramework: '$(TargetFramework)'." />

src/TestFramework/TestFramework.Windows.AppTesting/ApplicationTest.cs:124

  • The Character Map acceptance path closes normally and does not assert that cleanup terminated the process, so this forced-kill branch is untested; a regression here can leave desktop processes running after the suite. Add a test application that ignores CloseMainWindow and verify that cleanup terminates its process tree.
                    _ = appProcess.CloseMainWindow();
                    if (!appProcess.WaitForExit(5000))
                    {
                        appProcess.Kill(entireProcessTree: true);
                        _ = appProcess.WaitForExit(5000);

Comment thread src/Package/MSTest.Sdk/Sdk/Sdk.props.template
Cover invalid target frameworks, early process exit, startup timeout, and forced cleanup while correcting the standalone sample package version.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI review requested due to automatic review settings August 29, 2026 10:45
@github-actions

This comment has been minimized.

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.

Copilot review overview

Review tier: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — This check is case-sensitive, although the SDK accepts target framework monikers…
Pre-existing issues (2)
Severity Finding
Medium severity test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​WindowsAppTestingSdkTests.cs — This VSTest leg omits the roll-forward setting used by the MTP leg above. The repo-local toolchain… View comment
Low severity src/​Package/​MSTest.Sdk/​Sdk/​Sdk.props.template — These new user-facing SDK properties are missing from the SDK documentation tables.… View comment
Issues resolved since last review (4)
Severity Finding
Low severity src/​TestFramework/​TestFramework.Windows.AppTesting/​ApplicationTest.cs — The acceptance tests exercise only a responsive Character Map process. Add coverage for an app that… View resolved comment
Low severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — No test exercises this validation path: every generated acceptance TFM appends -windows. Add a… View resolved comment
Medium severity samples/​public/​DemoMSTestSdk/​ProjectUsingWindowsAppTesting/​ProjectUsingWindowsAppTesting.csproj — The non-SDK example cannot restore as written: MSTestWindowsAppTestingVersion is only defined by… View resolved comment
Medium severity samples/​public/​DemoMSTestSdk/​ProjectUsingWindowsAppTesting/​ProjectUsingWindowsAppTesting.csproj — This project is not listed in samples/public/DemoMSTestSdk/DemoMSTestSdk.sln. Because… View resolved comment
Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

src/TestFramework/TestFramework.Windows.AppTesting/PACKAGE.md:12

  • This standalone getting-started snippet does not pin MSTest.Sdk, and the README does not provide a global.json pin, so users copying it from the NuGet package page cannot resolve the project SDK. Include an SDK version here, consistent with src/Package/MSTest.Sdk/PACKAGE.md:9-16.
<Project Sdk="MSTest.Sdk">

src/Package/MSTest.Sdk/Sdk/Sdk.props.template:45

  • The repository's complete MSTest.Sdk property reference in docs/glossary.md:312-343 still lists only Aspire and Playwright and omits both new controls. Add an EnableWindowsAppTesting compatibility row (including its NativeAOT error and VSTest support) and document MSTestWindowsAppTestingVersion, otherwise the advertised complete reference is stale as soon as this feature ships.
    <EnableWindowsAppTesting Condition=" '$(EnableWindowsAppTesting)' == '' ">false</EnableWindowsAppTesting>
    <EnablePlaywright Condition=" '$(EnablePlaywright)' == '' ">false</EnablePlaywright>
    <AspireHostingTestingVersion Condition=" '$(AspireHostingTestingVersion)' == '' ">${AspireHostingTestingVersion}</AspireHostingTestingVersion>
    <MicrosoftNETTestSdkVersion Condition=" '$(MicrosoftNETTestSdkVersion)' == '' ">${MicrosoftNETTestSdkVersion}</MicrosoftNETTestSdkVersion>
    <MSTestWindowsAppTestingVersion Condition=" '$(MSTestWindowsAppTestingVersion)' == '' ">${MSTestWindowsAppTestingVersion}</MSTestWindowsAppTestingVersion>

Comment thread src/Package/MSTest.Sdk/Sdk/Features/WindowsAppTesting.targets Outdated
Apply desktop runtime roll-forward consistently to the VSTest acceptance leg and document the feature and version override properties.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI review requested due to automatic review settings August 29, 2026 11:02
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10862

The pre-step's extract data (test-file/line-range TSV) was unavailable in this run, so this review was derived directly from the PR's file diffs. Two new test files were added: a sample demo (CharacterMapTests.cs) and an acceptance-test suite (WindowsAppTestingSdkTests.cs) for the new EnableWindowsAppTesting MSTest.Sdk feature.

GradeTestMutationNotesHow to improve
B (80–89) new CharacterMapTests.
CharacterMap_
MainWindow_
IsVisible
N/A Sample/demo asset; single ControlType assertion, adequate for illustrating the API.
B (80–89) new CharacterMapTests.
CharacterMap_
MainWindow_
HasTitle
N/A Sample/demo asset; only checks the title is non-empty, not a specific expected value.
B (80–89) new WindowsAppTestingSdkTests.
ApplicationTearDown_
WhenApplicationNeverCreatesWindow_
TerminatesProcess
N/A Solid scenario, but the hardcoded 1s `WaitForExit` and silent `catch (ArgumentException)` could mask a slow-terminate flake under CI load. Add an explicit fail message covering the not-yet-exited case and consider a longer/backoff wait.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingMSTestRunner_
RunsDesktopTests
N/A Exercises the real MSTest runner path end-to-end and asserts exit code plus exact pass/fail/skip summary.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingVSTest_
RunsDesktopTests
N/A Covers the VSTest bridge path with deterministic exit-code and output assertions.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkIsNotWindows_
FailsWithClearError
N/A Verifies the build-time guard with the exact expected error message.
A (90–100) new WindowsAppTestingSdkTests.
ApplicationSetup_
WhenApplicationExitsBeforeCreatingWindow_
ReportsClearFailure
N/A Asserts the specific failure exit code and diagnostic message for the early-exit scenario.

Note on mutation column: production code for the new TestFramework.Windows.AppTesting classes (WindowTest, ApplicationTest, AutomationTest) is Windows-only and process/UI-Automation driven, so meaningful pseudo-mutation execution could not be resolved in this sandbox; marked N/A throughout rather than guessed.

No inline suggestions were posted — findings above are minor reliability/coverage notes rather than concrete, safely-anchorable mechanical fixes.

This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 54.2 AIC · ⌖ 1 AIC · ⊞ 16.9K · [◷]( · )

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.

Copilot review overview

Review tier: Balanced
Findings: 1 High severity

Pre-existing issues (1)
Severity Finding
High severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — This check is case-sensitive, although the SDK accepts target framework monikers… View comment
Issues resolved since last review (2)
Severity Finding
Low severity src/​Package/​MSTest.Sdk/​Sdk/​Sdk.props.template — These new user-facing SDK properties are missing from the SDK documentation tables.… View resolved comment
Medium severity test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​WindowsAppTestingSdkTests.cs — This VSTest leg omits the roll-forward setting used by the MTP leg above. The repo-local toolchain… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsAppTestingSdkTests.cs:150

  • The generated asset imports Microsoft.MSTest.Windows.AppTesting explicitly, so these acceptance tests do not exercise the implicit Using added by WindowsAppTesting.targets. Since the public sample relies on that implicit import and is intentionally excluded from sample CI, removing this using is needed to make a regression in the SDK feature fail automated coverage.
using Microsoft.MSTest.Windows.AppTesting;

@github-actions

This comment has been minimized.

Use MSBuild's target-platform parser, cover uppercase target framework monikers, and pin the package README SDK example.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI review requested due to automatic review settings August 29, 2026 11:31
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10862

GradeTestMutationNotesHow to improve
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkUsesUppercase_
IsAccepted
1/1 killed Directly exercises the case-insensitive TargetPlatformIdentifier fix; reverting it fails the build.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 48.8 AIC · ⌖ 0.905 AIC · ⊞ 16.9K · [◷]( · )

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Include the test SDK and default CodeCoverage and TrxReport extensions in the non-MSTest.Sdk equivalent configuration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05

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.

Copilot review overview

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — On a non-Windows build agent, enabling this feature still leaves EnableWindowsTargeting unset.…

Comment thread src/Package/MSTest.Sdk/Sdk/Features/WindowsAppTesting.targets
Copilot AI review requested due to automatic review settings August 29, 2026 12:30
@github-actions

This comment has been minimized.

Default EnableWindowsTargeting on non-Windows hosts without overriding consumers and cover the cross-targeted SDK build path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05

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.

Copilot review overview

Review tier: Balanced
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — The consumer-side targets still do not enable Windows targeting on non-Windows hosts. The similarly…
Issues resolved since last review (1)
Severity Finding
High severity src/​Package/​MSTest.Sdk/​Sdk/​Features/​WindowsAppTesting.targets — On a non-Windows build agent, enabling this feature still leaves EnableWindowsTargeting unset.… View resolved comment

Comment thread src/Package/MSTest.Sdk/Sdk/Features/WindowsAppTesting.targets
Copilot AI review requested due to automatic review settings August 29, 2026 12:41
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10862

GradeTestMutationNotesHow to improve
C (70-79) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenCrossTargetingFromNonWindows_
BuildsSuccessfully
1/2 killed Only checks the build exit code; a missing non-Windows framework-reference default would still pass silently. Assert output does not contain the NETSDK1100 framework-reference diagnostic.
B (80-89) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkUsesUppercase_
IsAccepted
2/2 killed Now asserts both exit code and the absence of the error text (already fixed per author reply).
B (80-89) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkIsNotWindows_
FailsWithClearError
2/2 killed Exit code plus exact error text pinned; solid negative test for the TFM guard.
A (90-100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingMSTestRunner_
RunsDesktopTests
3/3 killed Asserts exit code, exact pass/fail summary, and cleanup termination via a real PID handshake.
A (90-100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingVSTest_
RunsDesktopTests
3/3 killed Mirrors the MTP-runner test for the VSTest leg with exact pass count and process-cleanup verification.
A (90-100) new WindowsAppTestingSdkTests.
ApplicationSetup_
WhenApplicationExitsBeforeCreatingWindow_
ReportsClearFailure
2/2 killed Deterministic `cmd.exe /c exit 0` reliably exercises the early-exit branch with an exact error assertion.
A (90-100) new WindowsAppTestingSdkTests.
ApplicationTearDown_
WhenApplicationNeverCreatesWindow_
TerminatesProcess
3/3 killed Deterministic timeout with an exact message and independent verification that teardown actually killed the process.
B (80-89) new CharacterMapTests.
CharacterMap_
MainWindow_
IsVisible
1/1 killed (sample) Sample doc test; single meaningful assertion on control type is appropriate for a demo project.
B (80-89) new CharacterMapTests.
CharacterMap_
MainWindow_
HasTitle
1/1 killed (sample) Sample doc test; non-empty title check is a reasonable minimal assertion for a demo.

Overall this is a strong acceptance-test suite for the new Windows App Testing feature: it exercises MTP and VSTest runners, both the invalid- and valid-TFM guard paths, and deterministic early-exit/timeout scenarios with real process-cleanup verification, all under [DoNotParallelize] since they share a generated asset. The only gap is the cross-targeting-from-non-Windows test, which currently only proves the build succeeds without proving the Windows-only framework reference was actually skipped/resolved correctly — an inline suggestion was posted for that one.

This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Suggestions on the Files changed tab can be applied with one click. Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 135 AIC · ⌖ 1.03 AIC · ⊞ 16.9K · [◷]( · )

@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.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 135 AIC · ⌖ 1.03 AIC · ⊞ 16.9K ·

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.

Copilot review overview

Review tier: Balanced
Findings: None

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/Package/MSTest.Sdk/Sdk/VSTest/VSTest.targets:56

  • The new VSTest SDK import is not exercised by EnableWindowsAppTesting_WhenUsingVSTest_RunsDesktopTests: that test runs the already-built ClassicEngine executable through the VSTest front end, while UseVSTest remains at its default false. Consequently this import could be removed and the test would still pass. Add a Windows App Testing asset that sets <UseVSTest>true</UseVSTest> and build/run that project, as the existing VSTest SDK coverage does in SdkTests.cs:66-75.
  <Import Project="$(MSBuildThisFileDirectory)../Features/WindowsAppTesting.targets" Condition=" '$(EnableWindowsAppTesting)' == 'true' " />

Build and run a dedicated UseVSTest project and assert stable VSTest output instead of relying on a version banner.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI review requested due to automatic review settings August 29, 2026 13:09
@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10862

Reviewed the single new test file in this PR: test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsAppTestingSdkTests.cs (7 new acceptance test methods covering the EnableWindowsAppTesting MSTest SDK feature). These are process-spawning acceptance tests, so the ~120-line body exemption applies. Overall quality is strong: exit codes, summary counts, and specific error/output text are consistently asserted, and process-cleanup tests correctly verify termination. The one weaker test only checks a build's exit code without confirming the cross-targeting override path was actually exercised — see the inline suggestion.

GradeTestMutationNotesHow to improve
B (80–89) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenCrossTargetingFromNonWindows_
BuildsSuccessfully
1/2 killed Only asserts exit code 0; doesn't confirm the Windows-target restriction was actually bypassed. Assert output does not contain the Windows-target-framework error message.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkUsesUppercase_
IsAccepted
2/2 killed Checks exit code and absence of the error text for the uppercase-TFM acceptance path.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkIsNotWindows_
FailsWithClearError
2/2 killed Asserts exact exit code and exact clear-error message text.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingMSTestRunner_
RunsDesktopTests
3/3 killed Verifies exit code, exact pass/fail/skip summary, and process termination via PID file.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingVSTest_
RunsDesktopTests
3/3 killed Verifies exit code, run summary text, assembly name, and process termination.
A (90–100) new WindowsAppTestingSdkTests.
ApplicationSetup_
WhenApplicationExitsBeforeCreatingWindow_
ReportsClearFailure
2/2 killed Asserts specific failure exit code and exact clear-failure error text for early-exit apps.
A (90–100) new WindowsAppTestingSdkTests.
ApplicationTearDown_
WhenApplicationNeverCreatesWindow_
TerminatesProcess
3/3 killed Verifies failure exit code, timeout message, and that the hung process was actually terminated.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 89.9 AIC · ⌖ 1.44 AIC · ⊞ 16.9K · [◷]( · )

@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.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 89.9 AIC · ⌖ 1.44 AIC · ⊞ 16.9K ·

@github-actions

This comment has been minimized.

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.

Copilot review overview

Review tier: Balanced
Findings: None

Evaluate EnableWindowsTargeting directly for simulated non-Windows hosts and explicit consumer opt-outs while retaining real non-Windows build coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI review requested due to automatic review settings August 29, 2026 13:28

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.

Copilot review overview

Review tier: Balanced
Findings: None

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10862

This PR has already been through multiple review iterations (14 review threads, all addressed) covering STA threading, cancellation, SDK guard casing, cross-targeting defaults, and negative-path coverage. Re-reviewing the current HEAD, the test suite is now in solid shape. No new high-confidence actionable findings beyond what is already resolved in prior threads.

GradeTestMutationNotesHow to improve
B (80–89) new CharacterMapTests.
CharacterMap_
MainWindow_
HasTitle
1/2 killed Checks the title is non-empty but not a specific expected value; a mutation returning any non-empty placeholder string would survive. If charmap's window title is stable across OS locales, assert the exact expected title text.
A (90–100) new CharacterMapTests.
CharacterMap_
MainWindow_
IsVisible
2/2 killed Asserts the exact control type of the launched app's main window, catching handle/resolution regressions.
A (90–100) new WindowsAppTestingSdkTests.
ApplicationSetup_
WhenApplicationExitsBeforeCreatingWindow_
ReportsClearFailure
3/3 killed Drives an app that exits immediately and asserts both the failure exit code and exact diagnostic text.
A (90–100) new WindowsAppTestingSdkTests.
ApplicationTearDown_
WhenApplicationNeverCreatesWindow_
TerminatesProcess
4/4 killed Covers the startup-timeout branch, the exact timeout diagnostic, and independently verifies the forced-kill teardown terminated the child process.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenCrossTargetingFromNonWindows_
BuildsSuccessfully
3/3 killed Directly evaluates the EnableWindowsTargeting MSBuild property value under OS=Unix and separately confirms the simulated cross-targeting build still succeeds.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkIsNotWindows_
FailsWithClearError
2/2 killed Asserts both the non-zero exit code and the exact Windows-TFM guard error text for a plain net8.0 project.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenTargetFrameworkUsesUppercase_
IsAccepted
2/2 killed Verifies both the successful build and the absence of the non-Windows-TFM diagnostic, closing the case-sensitivity regression window.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingMSTestRunner_
RunsDesktopTests
3/3 killed Checks exit code, exact pass/fail/skip summary, and confirms teardown terminated the app process after MTP-driven execution.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenUsingVSTest_
RunsDesktopTests
3/3 killed Checks exit code, the exact VSTest pass/fail summary line, and process termination for the VSTest execution leg.
A (90–100) new WindowsAppTestingSdkTests.
EnableWindowsAppTesting_
WhenWindowsTargetingIsExplicitlyDisabled_
PreservesValue
1/1 killed Confirms an explicit consumer override of EnableWindowsTargeting is preserved rather than overwritten by the SDK default.

This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Re-run with /review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 153.5 AIC · ⌖ 0.993 AIC · ⊞ 16.9K · [◷]( · )

Include MSTest.Windows.AppTesting in NonWindowsTests.slnf so Linux and macOS acceptance tests can restore the locally built package.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 006cf5a8-6525-4ecb-829f-e83a99c4de05
Copilot AI review requested due to automatic review settings August 29, 2026 15:02

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.

Copilot review overview

Review tier: Balanced
Findings: None

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10862

Parallelization — assembly audited:

Test assembly Scope Workers Analyzer coverage
MSTest.Acceptance.IntegrationTests MethodLevel ([assembly: Parallelize] in Program.cs, unchanged by this PR) CPU count (Workers = 0) coverable once the parallel-safety analyzers ship (attribute-based opt-in)

Only one test-relevant file changed in this PR: test/IntegrationTests/MSTest.Acceptance.IntegrationTests/WindowsAppTestingSdkTests.cs (new file). No .runsettings / testconfig.json / MSBuild parallelization settings were touched.

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 1 — by severity: Critical 0 · High 0 · Warning 1 · Info 0.

Top actions (by expected value):

  1. No safety issues found. Consider whether the class-level [DoNotParallelize] can be replaced by a narrower [ResourceLock] once the shared build assets are confirmed independent per test (see Warning below).

Warning

  • [D · Low confidence] WindowsAppTestingSdkTests.cs:12 — The class carries [DoNotParallelize] inside an assembly opted into MethodLevel parallelism, so every method in this class (including the two [DynamicData]-driven, multi-TFM methods) is deferred out of the parallel set and run sequentially after it drains — a serial-tail throughput cost, not a race. This mirrors the existing precedent in ModernUwpTests.cs / ClassicUwpTests.cs, which apply the same class-level [DoNotParallelize] for comparable real-device/desktop-UI concerns (window focus and GUI automation on a single desktop session do not tolerate concurrent interference the way pure process/file state does), so the choice looks intentional and consistent with the codebase, not an oversight. Fix (optional, unquantified): each test method already uses a fixture-shared AssetFixture.ProjectPath but writes pid files under GUID-named paths and drives distinct sub-project folders (InvalidTargetFramework, UppercaseTargetFramework, CrossTargeting, CrossTargetingOptOut, VSTest) with no observed path or static-state collisions between methods; if desktop-UI focus contention is confirmed to only affect the four methods that actually launch a real window/process (EnableWindowsAppTesting_*_RunsDesktopTests, ApplicationSetup_*, ApplicationTearDown_*), a class-level [ResourceLock] scoped to those methods (leaving the pure build/property tests parallel) could recover some throughput — but this is unquantified and the safer default (matching precedent) is to leave [DoNotParallelize] as-is.

No category A/B/C findings: environment variables passed via TestHost.ExecuteAsync/DotnetCli.RunAsync are forwarded to the spawned child process only (not Environment.SetEnvironmentVariable on the current process); pid-file paths use Guid.NewGuid() names under a shared fixture directory, so no cross-test collision; the new ApplicationTest/WindowTest base classes in src/TestFramework/TestFramework.Windows.AppTesting store per-test state (AppProcess, MainWindow) in instance fields set/cleared in [TestInitialize]/[TestCleanup], not statics, so no cross-instance leakage.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers “is it parallel-safe?”; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 107.9 AIC · ⌖ 1.52 AIC · ⊞ 24.8K · [◷]( · )

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