Add HTTP transport for WebAssembly test hosts - #55672
Merged
Evangelink merged 2 commits intoAug 7, 2026
Merged
Conversation
Route browser and WASI Microsoft.Testing.Platform hosts through an authenticated loopback HTTP gateway while preserving named pipes for desktop test applications. Keep bootstrap secrets in an owner-only response file and add focused protocol, security, lifecycle, and integration coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b1bfb191-93c7-4891-85ce-098b0676f861
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Evangelink
enabled auto-merge
August 7, 2026 10:46
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an authenticated loopback HTTP transport path for dotnet test when executing WebAssembly (browser/WASI) test hosts, allowing the existing dotnettestcli binary protocol frames to be routed through the current handlers while preserving named pipes for desktop scenarios.
Changes:
- Introduces
HttpTestHostGateway(authenticated HTTP + CORS/PNA preflight) andProtocolMessageSerializerto round-trip protocol frames over HTTP. - Updates
TestApplicationto select HTTP vs named-pipe transport based on the module runtime identifier, and writes bootstrap arguments (endpoint + token) to an owner-only response file. - Adds targeted regression coverage (gateway behavior, transport selection, response-file redaction/permissions/cleanup, artifact post-processing skip for WASM) plus a Blazor WASM MSTest “probe” asset and build test.
Show a summary per file
| File | Description |
|---|---|
| test/TestAssets/TestProjects/DotnetTestDevices/Program.cs | Detects whether the HTTP transport was selected (including via response file) for device-orchestration test coverage. |
| test/TestAssets/TestProjects/DotnetTestDevices/DotnetTestDevices.csproj | Adds a test-only hook to force a browser-wasm RID to exercise HTTP transport selection. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/wwwroot/index.html | Adds minimal host page for the Blazor WASM probe asset. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/SampleTests.cs | Adds a basic MSTest test that asserts it’s running in browser-wasm. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/README.md | Documents current limitations and expected future Blazor lifecycle integration for dotnet test. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/Program.cs | Sets up a Blazor WASM app with a test runner service. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/Pages/Home.razor | Runs tests on startup and displays pass/fail status + exit code. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/BrowserTestRunner.cs | Runs MTP + MSTest in-process within the browser app. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/BlazorWasmTestApp.csproj | New Blazor WASM test app asset configured to run MSTest/MTP in browser-wasm. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/App.razor | Minimal router for the Blazor WASM probe asset. |
| test/TestAssets/TestProjects/BlazorWasmTestApp/_Imports.razor | Razor imports for the probe asset. |
| test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/VanillaWasmTests.cs | Adds a build-only test validating the new Blazor WASM probe asset builds. |
| test/dotnet.Tests/CommandTests/Test/TestApplicationLaunchTests.cs | Adds transport-selection tests (HTTP for WASM, pipes for desktop) and response-file redaction/permissions/cleanup assertions. |
| test/dotnet.Tests/CommandTests/Test/HttpTestHostGatewayTests.cs | Adds unit tests covering authenticated frame dispatch, CORS/PNA preflight behavior, and malformed/corrupt frame handling. |
| test/dotnet.Tests/CommandTests/Test/GivenDotnetTestSelectsDevice.cs | Adds an end-to-end device-orchestration test asserting HTTP transport selection. |
| test/dotnet.Tests/CommandTests/Test/ArtifactPostProcessingManagerTests.cs | Adds coverage for skipping artifact post-processing for WASM modules. |
| src/Cli/dotnet/Commands/Test/MTP/TestApplication.cs | Switches between pipe vs HTTP transport; creates owner-only bootstrap response file; redacts args for logging; disables control channel for HTTP. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/ProtocolMessageSerializer.cs | Extracts frame serialize/deserialize logic for reuse by HTTP gateway. |
| src/Cli/dotnet/Commands/Test/MTP/IPC/HttpTestHostGateway.cs | New HTTP listener that authenticates via bearer token and forwards protocol frames (with CORS/PNA support). |
| src/Cli/dotnet/Commands/Test/MTP/ArtifactPostProcessingManager.cs | Skips artifact post-processing for WASM modules until a browser-aware merge host exists. |
| src/Cli/dotnet/Commands/Test/CliConstants.cs | Adds new CLI constants for the HTTP transport and bootstrap options. |
Copilot's findings
- Files reviewed: 21/21 changed files
- Comments generated: 1
Parse the request Content-Type and compare its media type so valid application/octet-stream parameters remain interoperable. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b1bfb191-93c7-4891-85ce-098b0676f861
Member
Author
|
/ba-g #54914 |
YuliiaKovalova
approved these changes
Aug 7, 2026
Member
|
Is this going to work with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WebAssembly test hosts cannot connect to the named-pipe transport currently used by
dotnet test. Microsoft.Testing.Platform now supports the existingdotnettestclibinary protocol over authenticated HTTP, so the SDK needs a matching gateway to enable browser and WASI test execution.Summary
dotnet testhandlers without changing the wire contractThe HTTP path is covered both at the gateway boundary and end-to-end with a real MTP application reporting a passing test through
dotnet test. The remaining Blazor-specific work is for Blazor Gateway to consume the bootstrap response file, launch the browser, and provide those values to MTP inside the page.Validation
dotnet testexecution through the MTP HTTP clientRelated to #54091