Skip to content

Migrate Microsoft.NET.Sdk.BlazorWebAssembly.Tests to MSTest.Sdk on MTP#54861

Merged
Evangelink merged 8 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-blazor-tests
Jun 23, 2026
Merged

Migrate Microsoft.NET.Sdk.BlazorWebAssembly.Tests to MSTest.Sdk on MTP#54861
Evangelink merged 8 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-blazor-tests

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates Microsoft.NET.Sdk.BlazorWebAssembly.Tests from 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.

Evangelink and others added 2 commits June 18, 2026 11:09
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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 wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Evangelink and others added 3 commits June 18, 2026 16:12
…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>
@Evangelink Evangelink enabled auto-merge June 19, 2026 10:53
@Evangelink

Copy link
Copy Markdown
Member Author

/ba-g unrelated test failures

@Evangelink

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Evangelink and others added 3 commits June 22, 2026 19:02
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>
@Evangelink

Copy link
Copy Markdown
Member Author

/ba-g unrelated test failures

@Evangelink Evangelink merged commit 447460e into dotnet:main Jun 23, 2026
24 of 26 checks passed
@Evangelink Evangelink deleted the evangelink/mstest-mtp-blazor-tests branch June 24, 2026 13:15
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview6 milestone Jun 24, 2026
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.

3 participants