Skip to content

Migrate test infrastructure to Microsoft Testing Platform (MTP)#179

Merged
LittleLittleCloud merged 10 commits intomainfrom
copilot/migrate-to-mtp-testing
Nov 26, 2025
Merged

Migrate test infrastructure to Microsoft Testing Platform (MTP)#179
LittleLittleCloud merged 10 commits intomainfrom
copilot/migrate-to-mtp-testing

Conversation

Copy link
Contributor

Copilot AI commented Nov 23, 2025

Migrating RazorConsole test project to pure Microsoft Testing Platform (MTP) with xUnit v3.

  • Update RazorConsole.Tests.csproj to use MTP (xunit.v3 only)
  • Update Directory.Packages.props to include only MTP packages
  • Update CI workflow (.github/workflows/ci.yml) to use dotnet run for multi-framework testing
  • Fix xUnit v3 analyzer warning for Task.Delay to use TestContext.Current.CancellationToken
  • Verify the migration works by building and running tests on all target frameworks (net8.0, net9.0, net10.0)
  • Run code review and security checks

Summary

Successfully migrated RazorConsole to pure Microsoft Testing Platform (MTP) with xUnit v3, using native MTP test execution without VSTest dependencies.

Changes Made:

  1. Test Project Configuration: Added OutputType=Exe and UseMicrosoftTestingPlatformRunner=true to enable MTP
  2. Package Updates:
    • Added xunit.v3 (3.2.0) for MTP support
    • Added Microsoft.Testing.Extensions.CodeCoverage (18.0.4) for code coverage
    • Removed legacy xunit v2 packages (xunit, xunit.runner.visualstudio v2, coverlet.collector)
    • Removed VSTest packages (Microsoft.NET.Test.Sdk, xunit.runner.visualstudio v3)
  3. CI Workflow: Using dotnet run for each target framework (net8.0, net9.0, net10.0) to run tests via MTP
  4. Code Quality: Fixed xUnit v3 analyzer warning for better test cancellation support

Benefits:

  • ✅ Pure MTP implementation without VSTest dependencies
  • ✅ All 99 tests pass on net8.0, net9.0, and net10.0
  • ✅ Better IDE integration (VSC, VS, Rider) with native MTP support
  • ✅ Modern testing platform with cleaner dependency tree
  • ✅ Faster test execution with native MTP runner

Validation:

✅ All 99 tests pass on net8.0, net9.0, and net10.0
✅ Code formatting verified
✅ Security scan passed (0 vulnerabilities)
✅ CI workflow runs tests on all three target frameworks using MTP

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Migrate to MTP</issue_title>
<issue_description>### Feature Description

MTP is Microsoft testing platform. It's replaces old dotnet test.
MTP already wiedly supported (VSC, VS, Rider).

Docs:

Problem Statement

No response

Proposed Solution

Migration steps:

  • Modify .Tests repo.
    Remove
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="coverlet.collector" />

Add

  <PropertyGroup>
        <OutputType>Exe</OutputType>
        <UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="xunit.v3" Version="3.2.0" />
    <PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.0.4" />
  </ItemGroup>

(18.0.4 bc MC broke campatability in 18.1.* using old package without MTP)

  • Change CI
      - name: Test
        run: dotnet run src/RazorConsole.Tests.csproj --configuration Release --no-build --verbosity normal

Alternatives Considered

No response

Additional Context

No response

Contribution

  • I'd be willing to contribute this feature</issue_description>

Comments on the Issue (you are @copilot in this section)

@LittleLittleCloud Proposal LGTM. Just finished reading the MTP introduction and it Looks like something promising.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: ParadiseFallen <50731756+ParadiseFallen@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate testing framework to Microsoft Testing Platform Migrate test infrastructure to Microsoft Testing Platform (MTP) Nov 23, 2025
Copilot AI requested a review from ParadiseFallen November 23, 2025 19:25
Co-authored-by: ParadiseFallen <50731756+ParadiseFallen@users.noreply.github.com>
Co-authored-by: ParadiseFallen <50731756+ParadiseFallen@users.noreply.github.com>
Co-authored-by: ParadiseFallen <50731756+ParadiseFallen@users.noreply.github.com>
@ParadiseFallen
Copy link
Collaborator

@copilot retry

Co-authored-by: ParadiseFallen <50731756+ParadiseFallen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 24, 2025

@copilot retry

Completed pure MTP migration. Removed VSTest dependencies and using dotnet run to test all frameworks. All 99 tests pass. Commit: af80ef7

@ParadiseFallen ParadiseFallen marked this pull request as ready for review November 24, 2025 13:39
TeseySTD
TeseySTD previously approved these changes Nov 24, 2025
Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
@github-actions
Copy link

github-actions bot commented Nov 26, 2025

🚀 Preview Deployment

A preview build has been generated for this PR from CI run #19716042084!

Download the artifact:
website-preview-179-b35a82ecdc7572ab29da0f3e573873978056f761

To view the preview locally:

  1. Download the artifact from the CI workflow run
  2. Extract the ZIP file
  3. Serve the files with a local web server
    (e.g., npx serve dist)

⚠️ Cloudflare deployment failed. You can still download and test the artifact locally.

💡 Tip: For automatic live preview deployments, ensure Cloudflare Pages
is properly configured with the required secrets.

Signed-off-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
@LittleLittleCloud LittleLittleCloud merged commit b4b1984 into main Nov 26, 2025
6 checks passed
@LittleLittleCloud LittleLittleCloud deleted the copilot/migrate-to-mtp-testing branch November 26, 2025 20:59
@github-actions github-actions bot added this to the v0.2.0 milestone Nov 26, 2025
Copilot AI mentioned this pull request Nov 26, 2025
12 tasks
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.

[Feature]: Migrate to MTP

4 participants