Migrate Microsoft.NET.Sdk.StaticWebAssets.Tests to MSTest.Sdk on MTP#54856
Open
Evangelink wants to merge 14 commits into
Open
Migrate Microsoft.NET.Sdk.StaticWebAssets.Tests to MSTest.Sdk on MTP#54856Evangelink wants to merge 14 commits into
Evangelink wants to merge 14 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…undation' into evangelink/mstest-mtp-staticwebassets-tests
Resolved conflicts in DefineStaticWebAssetEndpointsTest, GenerateStaticWebAssetEndpointsPropsFileTest and ReadStaticWebAssetsManifestFileTest by taking main's newly added tests and converting them to MSTest ([Fact] -> [TestMethod]). Migrated four test files newly added on main from xUnit to MSTest ([Fact]/[PlatformSpecificFact] -> [TestMethod]/[OSCondition], added [TestClass]) and added [DoNotParallelize] to all CWD-mutating *MultiThreadingTest 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 StaticWebAssets baseline base classes (AspNetSdkBaselineTest, IsolatedNuGetPackageFolderAspNetSdkBaselineTest) are link-shared into Microsoft.NET.Sdk.BlazorWebAssembly.Tests. Migrating them to MSTest broke the still-xUnit BlazorWebAssembly test project (missing Microsoft.VisualStudio.TestTools / TestProperty, unimplemented abstract RestoreNugetPackagePath). Migrate that project to MSTest.Sdk as well: - Switch SDK to MSTest.Sdk and reference Microsoft.NET.TestFramework.MSTest. - Add global usings for the runner-agnostic TestFramework namespaces. - Convert Fact/Theory/condition attributes, InlineData->DataRow, and the xUnit Assert.* calls to their MSTest equivalents. - Replace ITestOutputHelper ctor injection with the MSTest base classes and override RestoreNugetPackagePath where needed. - Replace OSX early-return / Assert count checks per MSTest analyzers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g main The merge with main brought in test files that still used xUnit constructs, breaking the MSTest.Sdk migration build: - TypeScriptIntegrationTest.cs - StaticWebAssetsGeneratePackManifestMultiThreadingTest.cs - GenerateStaticWebAssetsPropsFileMultiThreadingTest.cs Also migrate Microsoft.NET.Sdk.BlazorWebAssembly.AoT.Tests to MSTest.Sdk, since it link-shares WasmPublishIntegrationTestBase.cs from the now-migrated BlazorWebAssembly.Tests project. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The migration tool inserted spurious blank lines throughout the migrated test files (including inside multi-line string literals used as test data), producing files with 2-5 blank lines between nearly every line. This restores the original blank-line structure (from main) while preserving all intended migration changes (xUnit -> MSTest attribute/assert conversions, usings, etc.). Only whitespace/blank lines are changed; non-blank content is identical to the prior commit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 19, 2026
Open
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
1 similar comment
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
main added two process-CWD-mutating tests still using xUnit [Fact] (ComputeReferenceStaticWebAssetItemsTest.MakeReferencedAssetOriginalItemSpecAbsolute_* and the new GenerateStaticWebAssetsManifestMultiThreadingTest). Since this PR migrated the project to MSTest.Sdk (globbing **/*.cs), those files would fail to compile (CS0246 'Fact'). Convert them to [TestMethod]/[TestClass] and mark the CWD-mutating tests [DoNotParallelize], matching the migration conventions used elsewhere in this project. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Evangelink
added a commit
to Evangelink/sdk
that referenced
this pull request
Jun 22, 2026
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>
The file was re-added on main with xUnit [Fact] attributes after Microsoft.DotNet.Cli.Utils.Tests was migrated to MSTest.Sdk, breaking the build (CS0246 Fact). Convert to [TestClass]/[TestMethod]. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This class mutates the process-global current working directory and shares a fixed temp path across its test methods. Under MSTest.Sdk MethodLevel parallelism the migrated methods raced, causing IOException ('file being used by another process') and DirectoryNotFoundException in CI. All sibling CWD-mutating classes in this project already carry [DoNotParallelize]; this one was missed during the xUnit->MSTest migration.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These tests mutate the process-global current directory via Directory.SetCurrentDirectory. The xUnit migration removed the [assembly:CollectionBehavior(DisableTestParallelization = true)] attribute that previously serialized the whole assembly, leaving only class-level [DoNotParallelize] which still allows other classes to corrupt the shared CWD in parallel. Restore the assembly-wide guarantee with [assembly: DoNotParallelize] (the repo convention for such projects), fixing the macOS CI failures in StaticWebAssetTaskEnvironmentTests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… conflict test/Directory.Build.props sets MSTestParallelizeScope=MethodLevel for all MSTest.Sdk test projects, which emits [assembly: Parallelize]. That collided with the [assembly: DoNotParallelize] added for this assembly, producing MSTEST0059 at build time. Clear the scope in this project (matching the dotnet-aot.Tests / dotnet-format.UnitTests convention) so no [Parallelize] attribute is emitted and the assembly runs serially. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.StaticWebAssets.Testsfrom xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), switching its test-framework reference toMicrosoft.NET.TestFramework.MSTest.Part of the SDK acceptance-test xUnit-->MSTest migration. Depends on #54845 (the
Microsoft.NET.TestFramework.MSTestfoundation) which must merge first. Compiles clean locally for all target frameworks.