Migrate tests to xunit.v3 4.x on Microsoft Testing Platform v2

Merged
BR
19d ago
+30-31

Motivation

xunit.v3 4.x uses Microsoft Testing Platform (MTP) v2 by default, so the VSTest adapter, test SDK, and VSTest loggers are no longer needed.

Modifications

  • Update xunit.v3 to 4.0.3 (pulls in xunit.v3.mtp-v2) and remove Microsoft.NET.Test.Sdk, xunit.runner.visualstudio, coverlet.collector, and JUnitTestLogger
  • Collect coverage with coverlet.MTP 10.1.0 (Cobertura output, same format as before)
  • Report results to GitHub Actions with GitHubActionsTestLogger 3.0.5, which supports MTP. It has no .NET Framework build, so it is referenced for .NET targets only
  • Opt dotnet test into MTP mode in global.json ("test": { "runner": "Microsoft.Testing.Platform" }), required by the .NET 10+ SDK
  • Resolve xUnit1069 on MalformedFrameInput: the test is now async and runs the synchronous CopyTo on a worker thread with TestContext.Current.CancellationToken, so the timeout ends the test even if a regression causes a hang inside a single Read call. It still exercises the synchronous path
  • Build workflow:
    • Replace --logger/--collect with --report-github --coverlet --coverlet-output-format cobertura --results-directory "${{ github.workspace }}/TestResults" and update the coverage upload paths
    • Remove the VSTEST_DISABLE_ARTIFACTS_DIRECTORY_VERIFICATION arm64 workaround
    • Windows job: target --project Snappier.Tests because MTP-mode dotnet test rejects --runtime on a solution (NETSDK1134); drop RunConfiguration.DisableAppDomain; no --report-github since the reporter has no net48 build; instead, xunit.v3's built-in TRX reporter writes Snappier.Tests-net48-<arch>.trx, uploaded as the test-results-net4-<arch> artifact (also on test failure)
    • Coverage cleanup: coverlet.MTP writes Windows paths with forward slashes, so the sed rewrite now matches either slash

Reviewer notes

  • Verified locally: build has no warnings; tests pass on net8.0 and net10.0 (281) and net48 x64/x86 (265), each producing a Cobertura file. The workflow itself has not run yet.
  • The Windows (net48) jobs no longer add a GitHub Actions test summary; their results are in the test-results-net4-<arch> TRX artifacts.

šŸ¤– Generated with Claude Code