Repository navigation
test: move the suites to xUnit 4 on Microsoft.Testing.Platform - #105
Conversation
xunit.v3 3.2.2 -> 4.0.2 and xunit.runner.visualstudio 3.1.5 -> 4.0.1 in
the four test projects.
xUnit 4 enables Microsoft.Testing.Platform by default, and the .NET 10 SDK
then refuses the VSTest `dotnet test` that ci.yml, release.yml and
sonar.yml run ("Testing with VSTest target is no longer supported").
The mtp-off flavour is the same xUnit 4 without that switch, so the
workflows and coverlet.collector, which feeds Sonar's coverage, keep
working unchanged.
Verified: 972 tests discovered and passing, the same count as on 3.2.2
(613 + 192 + 109 + 58), and the Sonar command still writes one
non-empty coverage.opencover.xml per test project.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019k6GsUrFe92DSgN3opCj6g
The previous commit kept xUnit 4 on VSTest through xunit.v3.mtp-off. This one takes the platform xUnit 4 is built for. - global.json opts `dotnet test` into Microsoft.Testing.Platform, so ci.yml and release.yml run unchanged (`dotnet test -c Release`). - Test projects reference xunit.v3 4.0.2 and drop Microsoft.NET.Test.Sdk and xunit.runner.visualstudio, which only served VSTest. - Coverage moves from coverlet.collector to coverlet.MTP 10.1.0. Its settings live in tests/testconfig.json, linked into every test project by Directory.Build.targets, replacing coverage.runsettings: still one committed file, so a local run and the analysis produce the same report. The file is authoritative for coverlet, so it names the measured assemblies instead of relying on injected defaults. - sonar.yml switches on coverage with --coverlet; coverlet.MTP stamps each report with a timestamp, so reportsPaths matches coverage.opencover.*.xml. - DocumentationSampleCompiler keeps the runner out of what samples compile against: Microsoft.Testing.* replaces testhost and the VSTest assemblies, which are no longer loaded. Verified from clean bin/obj: 972 tests pass with the ci.yml and the sonar.yml commands, and the four OpenCover reports cover the same modules with the same sequence and branch counts as under VSTest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019k6GsUrFe92DSgN3opCj6g
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
note: SonarCloud rejects SONAR_TOKEN at login; not caused by this PR The
The recent Dependabot PRs also fail Sonar, but differently: there the token arrives empty ( Fixing it needs a new token in SonarCloud (My Account → Security) stored as the Until then, SonarCloud's import of the coverage under MTP is unverified. Locally, the Generated by Claude Code |
|
question (blocking): Verify Sonar coverage import after authentication is restored
Could we restore the Sonar authentication and rerun this analysis, then verify that four reports were imported and the reported coverage did not regress? This is a verification blocker, not a confirmed defect in the MTP migration. |
|
ack: stays blocking until Sonar analyses this PR; token rotation needed Answers question (blocking): Verify Sonar coverage import after authentication is restored. Restoring authentication needs a new SonarCloud token stored in the
If either does not hold, I will fix it on this branch. Meanwhile, the regular CI confirms the tests themselves run under MTP: Generated by Claude Code |
|
note: Sonar imports all four MTP reports; coverage identical to main Answers question (blocking): Verify Sonar coverage import after authentication is restored. No code change was needed.
From the job log:
From the SonarCloud measures API,
Every number is identical, so moving from VSTest + coverlet.collector to MTP + coverlet.MTP changes nothing in what Sonar measures. Generated by Claude Code |
|
reviewed: Sonar coverage import verified after the MTP migration The successful Sonar rerun confirms that all 972 tests pass, all four timestamped OpenCover reports are parsed, all 13 main files have coverage, and the Quality Gate passes. The reported coverage matches |
Summary
Moves every test project from xUnit 3.2.2 to xUnit 4.0.2 and runs the suites on Microsoft.Testing.Platform (MTP), the platform xUnit 4 is built for. Coverage moves to coverlet's MTP extension, so the report Sonar reads is the same as before.
Type of change
Changes
global.jsonoptsdotnet testinto MTP ("test": { "runner": "Microsoft.Testing.Platform" }). Without it, the .NET 10 SDK refuses to run xUnit 4 through VSTest.ci.ymlandrelease.ymlrun unchanged.xunit.v34.0.2.Microsoft.NET.Test.Sdkandxunit.runner.visualstudioare dropped because they only served VSTest.coverlet.collectortocoverlet.MTP10.1.0.coverage.runsettingsis replaced bytests/testconfig.json, linked into every test project byDirectory.Build.targets. It is still one committed file, so a local run and the analysis produce the same report. The file is authoritative for coverlet (no defaults are injected), so it names the measured assemblies explicitly.sonar.ymlturns coverage on with--coverlet. coverlet.MTP adds a timestamp to each report's name, sosonar.cs.opencover.reportsPathsnow matchescoverage.opencover.*.xml.DocumentationSampleCompilerkeeps the test runner out of what doc samples compile against:Microsoft.Testing.*replacestesthostand the VSTest assemblies, which are no longer loaded.xunit.v3.mtp-off). The second commit supersedes it.Testing
dotnet build -c Release: clean from deletedbin/obj, 0 warnings, 0 errorsdotnet test -c Release: 972 tests passed, the same count as under xUnit 3.2.2 (613 + 192 + 109 + 58)tests/PackageSmokeTest/run.sh: not run. Packaging, the analyzers and the public entry points are untouched.Also run:
sonar.ymltest command. It writes four OpenCover reports, all matched by the newreportsPathsglob. They list the same modules with the same sequence and branch counts as the VSTest + coverlet.collector baseline.tools/style/lint-layout.sh: nothing to report.Not verifiable locally: SonarCloud's import of the new reports. Check that the coverage on this PR's analysis does not drop.
IDE note: without
xunit.runner.visualstudio, Test Explorer needs MTP support. Recent Visual Studio 2022, Rider and C# Dev Kit have it.Public API
Documentation
Generated by Claude Code