Skip to content

Migrate Microsoft.NET.Sdk.StaticWebAssets.Tests to MSTest.Sdk on MTP#54856

Open
Evangelink wants to merge 14 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-staticwebassets-tests
Open

Migrate Microsoft.NET.Sdk.StaticWebAssets.Tests to MSTest.Sdk on MTP#54856
Evangelink wants to merge 14 commits into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-staticwebassets-tests

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates Microsoft.NET.Sdk.StaticWebAssets.Tests from xUnit to MSTest.Sdk on Microsoft.Testing.Platform (MTP), switching its test-framework reference to Microsoft.NET.TestFramework.MSTest.

Part of the SDK acceptance-test xUnit-->MSTest migration. Depends on #54845 (the Microsoft.NET.TestFramework.MSTest foundation) which must merge first. Compiles clean locally for all target frameworks.

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 4 commits June 18, 2026 15:56
…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>
@Evangelink Evangelink requested a review from a team as a code owner June 19, 2026 14:28
Evangelink and others added 2 commits June 19, 2026 18:21
…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>
@Evangelink Evangelink enabled auto-merge June 19, 2026 16:59
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>
@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

Evangelink and others added 2 commits June 22, 2026 18:40
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>
Evangelink and others added 3 commits June 22, 2026 23:20
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>
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.

2 participants