Skip to content

Migrate Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests to MSTest.Sdk on MTP - #54862

Merged
Evangelink merged 16 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-blazoraot-tests
Jun 26, 2026
Merged

Migrate Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests to MSTest.Sdk on MTP#54862
Evangelink merged 16 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-blazoraot-tests

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests from xUnit to MSTest.Sdk on MTP.

Depends on #54845 (foundation) and #54861 (BlazorWebAssembly.Tests) — it link-compiles WasmPublishIntegrationTestBase / BootJsonData / ServiceWorkerAssert from the Blazor tests, so this branch is stacked on that one. Merge after both. Compiles clean locally.

…n MTP

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 18, 2026 12:56
@Evangelink
Evangelink requested a review from a team as a code owner June 18, 2026 12:56

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 2 commits June 18, 2026 16:10
…undation' into evangelink/mstest-mtp-blazoraot-tests
Resolves conflicts in StaticWebAssets test files and converts newly merged
xUnit-style tests/attributes from main to MSTest:
- [Fact] -> [TestMethod]; added [TestClass] (+ [DoNotParallelize] for CWD-mutating MT tests)
- [PlatformSpecificFact(TestPlatforms.X)] / [PlatformSpecific(...)] -> [TestMethod] + [OSCondition(...)]
- [WindowsOnlyRequiresMSBuildVersion(v)] -> [OSCondition(OperatingSystems.Windows)] + [RequiresMSBuildVersion(v)]

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

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

1 similar comment
@Evangelink

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

…-blazoraot-tests

# Conflicts:
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ComputeReferenceStaticWebAssetItemsTest.cs
@Evangelink
Evangelink enabled auto-merge June 22, 2026 10:10
Copilot AI and others added 2 commits June 22, 2026 12:41
Three files merged in from main still used xUnit constructs after the project moved to MSTest.Sdk, breaking the build:
- GenerateStaticWebAssetsPropsFileMultiThreadingTest
- StaticWebAssetsGeneratePackManifestMultiThreadingTest
- TypeScriptIntegrationTest

Convert [Fact] to [TestMethod], add [TestClass]/[DoNotParallelize], implement the now-abstract RestoreNugetPackagePath, replace the ITestOutputHelper ctor with the parameterless MSTest pattern, and use TestContext.CancellationToken.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Evangelink and others added 2 commits June 22, 2026 14:58
This test file was added on main by dotnet#54704 after this branch migrated Microsoft.NET.Sdk.StaticWebAssets.Tests to MSTest.Sdk, so the merge reintroduced xUnit [Fact] usage that no longer compiles (CS0246 FactAttribute/Fact). Convert it to [TestClass]/[TestMethod] with [DoNotParallelize], matching the sibling MultiThreading tests.

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

Copy link
Copy Markdown
Member Author

/ba-g unrelated test issues

Evangelink and others added 6 commits June 22, 2026 19:50
The migration tooling inserted large numbers of blank lines throughout the StaticWebAssets/Blazor test files. Restore the original blank-line layout from main while preserving all migrated content (xUnit->MSTest attribute swaps, usings, [TestClass]). No non-blank content changes; reduces the diff by ~50k spurious lines.

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

A merge with main reintroduced the xUnit [Fact] version of this file while the
Microsoft.DotNet.Cli.Utils.Tests project is MSTest.Sdk, causing CS0246
('Fact' could not be found) and breaking every build leg. Restore the
[TestClass]/[TestMethod] version that exists on main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The xUnit project disabled parallelization assembly-wide via [assembly: CollectionBehavior(DisableTestParallelization = true)]. The MSTest migration dropped that and inherited the repo-wide MethodLevel default, so methods now run in parallel. These integration tests are not parallel-safe: many methods in a class share a fixed test asset directory (helpers use [CallerMemberName]) and several task tests mutate the process-global current directory via Directory.SetCurrentDirectory, producing file-in-use, file-already-exists, missing-metadata and deleted-cwd (GetCwd) races. Setting MSTestParallelizeScope=None emits [assembly: DoNotParallelize], restoring the original fully-serialized semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve conflicts in test files migrated to MSTest. Both main and this
branch performed the equivalent xUnit->MSTest migration, so conflicts were
limited to whitespace, attribute ordering, and per-test [DoNotParallelize]
annotations. This branch fully serializes the StaticWebAssets test assembly
via MSTestParallelizeScope=None, making main's granular [DoNotParallelize]
attributes redundant, so the branch's versions were kept.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Evangelink and others added 2 commits June 25, 2026 16:19
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/CollectStaticWebAssetsToCopyMultiThreadingTest.cs
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/MergeConfigurationPropertiesMultiThreadingTest.cs
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadStaticWebAssetsManifestFileMultiThreadingTest.cs
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetTaskEnvironmentTests.cs
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetsGeneratePackManifestMultiThreadingTest.cs
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetsGeneratePackagePropsFileMultiThreadingTest.cs
#	test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/UpdatePackageStaticWebAssetsMultiThreadingTest.cs
@Evangelink

Copy link
Copy Markdown
Member Author

/ba-g timeout issue with Microsoft.WebTools.AspireService.Tests.dll

@Evangelink
Evangelink merged commit 08bc948 into dotnet:main Jun 26, 2026
22 of 25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jun 29, 2026
pull Bot pushed a commit to sysfce2/dotnet-sdk that referenced this pull request Jun 29, 2026
Migrates the three test projects that still used xUnit (v3) to MSTest.Sdk on
Microsoft.Testing.Platform, following the pattern established by the sibling
migration PRs (dotnet#54883, dotnet#54862, dotnet#54904):

- test/Microsoft.NET.Build.Containers.IntegrationTests
- test/TemplateEngine/.../TemplateVerifier.IntegrationTests
- test/TemplateEngine/.../TemplateVerifier.UnitTests

Verify.XunitV3 blocker (the two TemplateVerifier projects):
The TemplateVerifier tool''s VerificationEngine drives snapshot verification
through Verify.XunitV3 by default, which resolves the running test from xUnit''s
ambient context and fails under MSTest (TestContext.TestMethod is null). Added a
pluggable static VerificationEngine.DirectoryVerifier hook (with a NoInlining
DefaultVerifyDirectory that keeps the xUnit reference off the default path) so
MSTest consumers route directory verification to VerifyMSTest.Verifier.VerifyDirectory.
Each migrated project wires this via a ModuleInitializer (VerifyDirectoryInitializer)
and marks its snapshot classes [UsesVerify]; tests reference Verify.MSTest instead
of Verify.XunitV3.

test/TemplateEngine/Directory.Build.props now references Microsoft.NET.TestFramework.MSTest
for UsingMSTestSdk projects (and keeps the xUnit framework for the rest), and sets
SolutionDir/SolutionName so Verify''s solution auto-discovery does not warn under warnaserror.

Containers.IntegrationTests: custom xUnit Docker Fact/Theory attributes became
MSTest ConditionBaseAttribute gates (DockerUnavailableCondition, PodmanCliCondition,
ContainerdStoreUnavailableCondition, DockerSupportsArchCondition); collection
definitions became [DoNotParallelize]; ITestOutputHelper injection became SdkTest.Log;
[Fact]/[Theory]/[InlineData] -> [TestMethod]/[DataRow]; assertions ported to MSTest.

All three projects build cleanly (0 errors, 0 warnings). Tests were not run as part
of this change, matching the sibling migration PRs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink
Evangelink deleted the evangelink/mstest-mtp-blazoraot-tests branch June 29, 2026 17:46
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.

7 participants