Skip to content

chore: migrate test projects to microsoft.testing.platform - #930

Merged
milkshakeuk merged 2 commits into
masterfrom
chore/mtp
Nov 16, 2026
Merged

milkshakeuk merged 2 commits into
masterfrom
chore/mtp

Conversation

@milkshakeuk

@milkshakeuk milkshakeuk commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves the test projects from VSTest to Microsoft.Testing.Platform (MTP). Stacked on #929.

  • Runner: a new tests/Directory.Build.props enables NUnit's MTP runner (EnableNUnitRunner, OutputType Exe) for every test project except NHapi.Benchmarks. The src projects are unaffected.
  • global.json: adds "test": { "runner": "Microsoft.Testing.Platform" }, so dotnet test runs in MTP mode on the .NET 10 SDK.
  • Packages removed: Microsoft.NET.Test.Sdk and coverlet.collector (VSTest only).
  • Packages added: Microsoft.Testing.Extensions.CodeCoverage 18.12.0 and Microsoft.Testing.Extensions.TrxReport 2.5.3 (both latest).
  • Verify exemption: the Verify OpenSource maintenance-fee exemption moves into tests/Directory.Build.props, so any test project using Verify is covered.
  • Workflows and build/default.ps1: only the dotnet test invocations change. ci: fix code scanning alerts in workflows #929's permissions and artifact hardening are untouched.

Command changes

Purpose Before After
Project dotnet test X.csproj dotnet test --project X.csproj
TRX --logger "trx;LogFilePrefix=TestResults" --report-trx
Coverage --collect:"XPlat Code Coverage" --coverage --coverage-output-format cobertura --coverage-output coverage.cobertura.xml --results-directory-layout per-module
Filter --filter TestFixture=X --filter "FullyQualifiedName~X"

SourceGeneration no longer collects coverage. All its tests are [Explicit], so it would only produce an empty report.

Testing

Local net10.0:

  • NHapi.Base.NUnit: 321 passed, 3 skipped.
  • NHapi.NUnit: 964 passed, 13 skipped. The extra 11 skipped are [Explicit] TestParseORL_O34 cases, which VSTest omitted from the count.
  • Build: 0 errors, warning count unchanged.
  • TRX lands in TestResults/*.trx, and coverage lands in TestResults/<project>/<tfm>_x64/coverage.cobertura.xml. Both match the existing workflow globs.

Needs CI to confirm

  • net462 tests on Windows under MTP
  • EnricoMi parsing MTP-generated TRX
  • Codacy accepting coverage from Microsoft's extension. The figures may differ slightly from coverlet's.

@codacy-production

codacy-production Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage · 0.00% coverage variation

Metric Results
Coverage variation ✅ 0.00% coverage variation
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (36f525e) 1020600 22935 2.25%
Head commit (1659c1a) 1018621 (-1979) 22857 (-78) 2.24% (0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#930) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Unit Test Results

    5 files      5 suites   11s ⏱️
1 431 tests 1 343 ✅  88 💤 0 ❌
2 692 runs  2 588 ✅ 104 💤 0 ❌

Results for commit 1659c1a.

♻️ This comment has been updated with latest results.

@milkshakeuk
milkshakeuk force-pushed the ci/fix-code-scanning-alerts branch from 054a79f to 542afff Compare November 16, 2026 12:26
Base automatically changed from ci/fix-code-scanning-alerts to master November 16, 2026 12:52
Enable the NUnit MTP runner for the test projects through a new
tests/Directory.Build.props and opt dotnet test into native MTP mode in
global.json. Replace Microsoft.NET.Test.Sdk and coverlet.collector with
Microsoft.Testing.Extensions.CodeCoverage and
Microsoft.Testing.Extensions.TrxReport, and update the workflow and
psake dotnet test invocations to the MTP switches.
@sonarqubecloud

Copy link
Copy Markdown

@milkshakeuk
milkshakeuk merged commit 9c65ab4 into master Nov 16, 2026
14 checks passed
@milkshakeuk
milkshakeuk deleted the chore/mtp branch November 16, 2026 14:19
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.

1 participant