Skip to content

Migrate tests to xUnit v3 and Microsoft.Testing.Platform - #3

Closed
trejjam wants to merge 2 commits into
upstream-mainfrom
feature/xunit-v3
Closed

trejjam wants to merge 2 commits into
upstream-mainfrom
feature/xunit-v3

Conversation

@trejjam

@trejjam trejjam commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Moves the test project from xUnit v2 to v3, as offered in Giorgi#100, and runs it on Microsoft.Testing.Platform (MTP) instead of VSTest. With v3, tests can call Assert.Skip() at runtime, which the Devart provider tests need when no license key is set.

Based on upstream main, so the diff is exactly what would go upstream. There are two commits, so the xUnit and MTP steps can be reviewed separately.

Migrate tests to xUnit v3

  • xunit 2.6.2 → xunit.v3 4.0.2, OutputType set to Exe
  • DemoContextFixture implements the v3 IAsyncLifetime (ValueTask)

Run tests on Microsoft.Testing.Platform

  • global.json opts dotnet test into MTP. The .NET 10 SDK no longer runs MTP projects such as xUnit v3 through VSTest.
  • Removed the VSTest packages: Microsoft.NET.Test.Sdk, xunit.runner.visualstudio, coverlet.msbuild, coverlet.collector
  • Coverage comes from coverlet.MTP (--coverlet), and test reporting from GitHubActionsTestLogger 3.0.5's MTP extension (--report-github). The logger no longer restricts IncludeAssets, because MTP's generated registration code needs its compile assets.
  • Workflows: the /p:CollectCoverage and --logger GitHubActions arguments are replaced with their MTP equivalents. coverlet.MTP instruments every referenced assembly that has symbols (xunit, Testcontainers, …), so only EntityFrameworkCore.Exceptions.* and DbExceptionClassifier.* are included. Reports go to TestResults/. coverlet.MTP adds a timestamp to the report name, so the Build workflow renames the lcov file before Coveralls reads it, and Sonar uses a wildcard path.
  • Tests/Directory.Build.props sets the assembly name to EntityFramework.Exceptions.$(MSBuildProjectName) instead of using $(SolutionName). MTP-mode dotnet test evaluates the project without a solution and would look for .Tests. The resulting name is unchanged.

Verification

  • The Build workflow on this branch runs 100 tests: 92 passed, 8 skipped (the existing Skip attributes), the same as before. The lcov report contains only the library sources, and the *Exception classes are still excluded.
  • The SonarCloud test command was run locally in Release (SQLite subset) and produced the opencover report. The workflow itself runs from the base branch (pull_request_target), so this PR does not exercise the changed Sonar step.

The build reports many xUnit1051 warnings (pass TestContext.Current.CancellationToken). They are left alone to keep this diff small.

Replace xunit 2.6.2 with xunit.v3 and move IAsyncLifetime fixtures to ValueTask.
Tests keep running through VSTest, so the existing dotnet test arguments in the
Build and SonarCloud workflows (GitHubActions logger, coverlet.msbuild) still work.
Bump coverlet, GitHubActionsTestLogger and Microsoft.NET.Test.Sdk: coverlet 3.2.0
fails to instrument the v3 test executable, and the logger's MTP registration
needs its compile assets.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T23:53:54.145417Z 9b0c1cd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coveralls

coveralls commented Nov 4, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 41938684906

Warning

No base build found for commit 7f4e2d0 on upstream-main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 92.515%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 207
Covered Lines: 202
Line Coverage: 97.58%
Relevant Branches: 127
Covered Branches: 107
Branch Coverage: 84.25%
Branches in Coverage %: Yes
Coverage Strength: 37.32 hits per line

💛 - Coveralls

Opt dotnet test into Microsoft.Testing.Platform through global.json and drop the
VSTest packages (Microsoft.NET.Test.Sdk, xunit.runner.visualstudio, coverlet.msbuild,
coverlet.collector). Coverage now comes from coverlet.MTP and the GitHub Actions
report from GitHubActionsTestLogger's MTP extension (--report-github).

coverlet.MTP instruments every referenced assembly that has symbols, so the workflows
include only the EntityFrameworkCore.Exceptions and DbExceptionClassifier assemblies.

The test assembly name no longer uses $(SolutionName): MTP-mode dotnet test evaluates
the project without a solution and would look for '.Tests'.
@trejjam trejjam changed the title Migrate tests to xUnit v3 Migrate tests to xUnit v3 and Microsoft.Testing.Platform Nov 5, 2026
@trejjam trejjam closed this Nov 5, 2026

This branch was previously deployed

1 inactive deployment
internal — f0543bf6 Deployed Nov 5, 2026 by trejjam via Authorize #2
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