Skip to content

Migrate Microsoft.TemplateEngine.IDE.IntegrationTests to MSTest.Sdk on MTP#54760

Closed
Evangelink wants to merge 1 commit into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-templateengine-ide
Closed

Migrate Microsoft.TemplateEngine.IDE.IntegrationTests to MSTest.Sdk on MTP#54760
Evangelink wants to merge 1 commit into
dotnet:mainfrom
Evangelink:evangelink/mstest-mtp-templateengine-ide

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Migrates the IDE.IntegrationTests project from xUnit v3 to MSTest.Sdk on Microsoft.Testing.Platform. Follows the same pattern as #54758 and #54759.

cc @Evangelink

Copilot AI review requested due to automatic review settings June 13, 2026 15:52

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.

Pull request overview

This PR migrates Microsoft.TemplateEngine.IDE.IntegrationTests from xUnit v3 to MSTest.Sdk on Microsoft.Testing.Platform (MTP), aligning it with the patterns used in the referenced migrations (#54758 / #54759).

Changes:

  • Switch the test project to MSTest.Sdk and convert xUnit attributes/assertions to MSTest equivalents.
  • Replace xUnit logging/fixture patterns with MSTest TestContext + a TestContextLogger adapter.
  • Remove Verify.xUnit fixture plumbing and replace the few remaining approval-style checks with a minimal local snapshot comparer.
Show a summary per file
File Description
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/Microsoft.TemplateEngine.IDE.IntegrationTests.csproj Switch project SDK to MSTest.Sdk and remove xUnit/Verify package references.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/GlobalUsings.cs Add explicit aliases for MSTest Assert/TestContext to avoid ambiguity with transitive xUnit types.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/TestContextLogger.cs New ILogger adapter forwarding logs into MSTest per-test output.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/SnapshotComparer.cs New minimal approval-file comparer replacing prior Verify usage in this project.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifyTestCollection.cs Remove xUnit collection definition (no longer applicable).
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/VerifySettingsFixture.cs Remove xUnit Verify fixture initialization (no longer applicable).
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/SnapshotTests.cs Convert to MSTest [TestClass]/[TestMethod], replace xUnit output helper with TestContextLogger, update cancellation token usage.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/LocalizationTests.cs Convert to MSTest; preserve sequential execution via [DoNotParallelize]; update asserts and cancellation tokens.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/BasicTests.cs Convert to MSTest; replace Verify calls with SnapshotComparer; replace fixture with static Lazy<PackageManager>.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/TemplatePackagesTests.cs Convert to MSTest; replace fixture with static Lazy<PackageManager>; update cancellation tokens/asserts.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/End2EndTests.cs Convert to MSTest; replace Verify calls with SnapshotComparer; update cancellation tokens/asserts and skip -> [Ignore].
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/ConfigurationTests.cs Convert to MSTest and update cancellation token usage/asserts.
test/TemplateEngine/Microsoft.TemplateEngine.IDE.IntegrationTests/FileRenameTests.cs Convert to MSTest + DynamicData-based data-driven tests; replace fixture with static Lazy<PackageManager>.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 4

[MemberData(nameof(Get_FileRename_TestData))]
internal async Task GetCreationEffectsTest(string templateName, string parameters, MockCreationEffects expectedResult)
[TestMethod]
[DynamicData(nameof(Get_FileRename_TestData))]
[MemberData(nameof(Get_FileRename_TestData))]
internal async Task CreateTest(string templateName, string parameters, MockCreationEffects expectedResult)
[TestMethod]
[DynamicData(nameof(Get_FileRename_TestData))]
[MemberData(nameof(Get_FileRename_TestData))]
internal async Task GetCreationEffectsTest_Package(string templateName, string parameters, MockCreationEffects expectedResult)
[TestMethod]
[DynamicData(nameof(Get_FileRename_TestData))]
[MemberData(nameof(Get_FileRename_TestData))]
internal async Task CreateTest_Package(string templateName, string parameters, MockCreationEffects expectedResult)
[TestMethod]
[DynamicData(nameof(Get_FileRename_TestData))]
@Evangelink

Copy link
Copy Markdown
Member Author

Closing this PR.

Migration is blocked by a fundamental incompatibility: Microsoft.TemplateEngine.IDE.IntegrationTests consumes Microsoft.TemplateEngine.Authoring.TemplateVerifier which depends on Verify.XunitV3. The Verify framework's xUnit-v3 adapter detects the test context via TestContext.Current.TestMethod (xUnit-v3 type). When the consumer is an MSTest test, that context is never populated and every VerificationEngine.Execute(...) call fails with System.Exception: TestContext.TestMethod is null.

CI evidence (build 1462864) — every SnapshotTests/End2EndTests/LegacyTests/etc Verify-based test failed on linux, macOS, Windows, and FullFramework Windows with that exact exception.

Migrating this project safely requires either:

  1. Reworking Microsoft.TemplateEngine.Authoring.TemplateVerifier to be test-framework-agnostic (use Verifier.Verify(...) overloads with explicit UseFileName/UseDirectory rather than relying on a framework adapter).
  2. Adding a Verify.MSTest variant of the tool.
  3. Rewriting the affected tests to not go through VerificationEngine.

None of these are safe surgical changes for this PR, so closing for now. Re-opening requires the upstream tool change first.

@Evangelink Evangelink closed this Jun 13, 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.

2 participants