Migrate Microsoft.NET.Sdk.BlazorWebAssembly.Tests to MSTest.Sdk on MTP#54861
Merged
Evangelink merged 8 commits intoJun 23, 2026
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ia [OSCondition] Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolved conflicts in DefineStaticWebAssetEndpointsTest, GenerateStaticWebAssetEndpointsPropsFileTest and ReadStaticWebAssetsManifestFileTest by taking main's newly added tests and converting them to MSTest ([Fact] -> [TestMethod]). Migrated newly added/incompletely-migrated test code from xUnit to MSTest ([Fact]/[PlatformSpecificFact]/[PlatformSpecific] -> [TestMethod]/[OSCondition], added [TestClass]) and added [DoNotParallelize] to all CWD-mutating *MultiThreadingTest and TaskEnvironment test classes (xUnit's assembly-wide DisableTestParallelization no longer applies under MSTest method-level parallelization). Removed an accidentally committed .bak file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The AoT.Tests project link-compiles WasmPublishIntegrationTestBase.cs from the migrated .Tests project, which now uses MSTest's [TestClass]. Since AoT.Tests was still on Microsoft.NET.Sdk/xUnit, the shared file failed to compile (CS0234/CS0246: missing Microsoft.VisualStudio.TestTools.UnitTesting). Migrate it consistently with the .Tests project: switch to MSTest.Sdk, drop OutputType/PackageId, reference Microsoft.NET.TestFramework.MSTest, add the TestFramework Using items, and convert the xUnit test class to MSTest ([TestClass]/[TestMethod], drop the ITestOutputHelper ctor since the MSTest base uses TestContext). Preserve the AoT-only BuildHelixPayload gating. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/ba-g unrelated test failures |
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
Resolve the ComputeReferenceStaticWebAssetItemsTest.cs conflict and convert the xUnit test files main newly added to Microsoft.NET.Sdk.StaticWebAssets.Tests (TypeScriptIntegrationTest, GenerateStaticWebAssetsManifestMultiThreadingTest, GenerateStaticWebAssetsPropsFileMultiThreadingTest, StaticWebAssetsGeneratePackManifestMultiThreadingTest) to MSTest. These files do not exist on the PR head but were added on main as xUnit [Fact]; since this PR migrates the project to MSTest.Sdk (globbing **/*.cs) they would otherwise fail to compile (CS0246 'Fact'). Adopted the already-migrated, build-verified versions from the StaticWebAssets migration PR (dotnet#54856). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… build Microsoft.DotNet.Cli.Utils.Tests is an MSTest.Sdk project, but TransientSdkResolutionErrorDetectorTests.cs was added still using xUnit [Fact], so the test build fails with CS0246 'Fact'/'FactAttribute' on main and on every PR built against it (including this one). Add [TestClass] and convert the five [Fact] methods to [TestMethod]; MSTest.Sdk provides the MSTest namespace and FluentAssertions as implicit global usings, so no using changes are needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… execution The migration to MSTest.Sdk introduced two regressions in Microsoft.NET.Sdk.StaticWebAssets.Tests: 1. Pervasive spurious blank lines were inserted across 69 test files. Where the extra blanks landed inside multi-line verbatim/raw string literals used as assertion expectations, tests failed because the expected text no longer matched the generated output (e.g. GenerateV1StaticWebAssetsManifestTest.AllowsMultipleContentRootsWithSameBasePath_ForTheSameSourceId). Each file is reconstructed using main as the ground truth for blank-line placement; every non-blank line is byte-identical to the migrated content, so only blank lines changed. 2. The assembly-wide xUnit [assembly: CollectionBehavior(DisableTestParallelization = true)] was dropped. MSTest.Sdk parallelizes at MethodLevel by default (set repo-wide in test/Directory.Build.props), so tests began racing on shared on-disk test asset directories and NuGet caches (e.g. the BuildFrameworkAssetsConsumer helper), producing failures such as FrameworkAssetsIntegrationTest.Build_Consumer_MaterializesFrameworkAssets "Root element is missing". Setting MSTestParallelizeScope=None makes MSTest.Sdk emit [assembly: DoNotParallelize], restoring sequential execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/ba-g unrelated test failures |
JeremyKuhne
approved these changes
Jun 23, 2026
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.
Migrates
Microsoft.NET.Sdk.BlazorWebAssembly.Testsfrom xUnit to MSTest.Sdk on MTP.Depends on #54845 (foundation) and #54856 (StaticWebAssets.Tests) — it link-compiles the migrated
AspNetSdkBaselineTest/IsolatedNuGetPackageFolderAspNetSdkBaselineTest/ baseline factory+comparer from StaticWebAssets.Tests, so this branch is stacked on that one. Merge after both. Compiles clean locally.