Skip to content

test: Upgrade to xUnit v3 and mtp v2#681

Merged
askpt merged 1 commit into
mainfrom
feat/xunit-v3-upgrade
May 27, 2026
Merged

test: Upgrade to xUnit v3 and mtp v2#681
askpt merged 1 commit into
mainfrom
feat/xunit-v3-upgrade

Conversation

@benjiro

@benjiro benjiro commented Dec 31, 2025

Copy link
Copy Markdown
Member

This PR

This PR upgrades the test infrastructure to use xUnit v3 and Microsoft.Testing.Platform (mtp) v2, modernizing the testing framework across all test projects in the dotnet-sdk.

  • Upgrades xUnit to v3
  • Upgrades Microsoft.Testing.Platform to v2
  • Updates all test projects to use the new testing framework versions
  • Refactors test assertions and lifecycle management to be compatible with xUnit v3 APIs
  • Updates Directory.Packages.props with new package versions
  • Adds global.json configuration

Related Issues

Fixes #624
Fixes #648

Notes

This is a significant infrastructure upgrade that affects all test projects:

  • OpenFeature.E2ETests
  • OpenFeature.Hosting.Tests
  • OpenFeature.IntegrationTests
  • OpenFeature.Providers.MultiProvider.Tests
  • OpenFeature.Tests

The changes include updates to test lifecycle management and assertion patterns to align with xUnit v3 conventions. Net reduction of ~40 lines of code across the test suite while maintaining all existing test coverage.

How to test

  1. Clone the repository
  2. Run dotnet test to execute the full test suite
  3. Verify all tests pass with the new xUnit v3 and mtp v2 framework
  4. Check that test output and reporting work as expected

@benjiro benjiro requested a review from a team as a code owner December 31, 2025 00:37
@benjiro benjiro marked this pull request as draft December 31, 2025 00:38
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @benjiro, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a significant infrastructure upgrade by migrating the entire test suite to xUnit v3 and Microsoft.Testing.Platform v2. This modernization effort involves updating package dependencies, adjusting project configurations, and refactoring asynchronous test logic to incorporate cancellation tokens and optimized async return types. The changes aim to enhance the robustness, maintainability, and performance of the testing framework without altering existing test coverage.

Highlights

  • Testing Framework Upgrade: The test infrastructure has been upgraded to xUnit v3 and Microsoft.Testing.Platform (mtp) v2, modernizing the entire testing framework across all test projects.
  • Package Version Updates: Key testing-related package versions have been updated in Directory.Packages.props, including Reqnroll.xunit.v3, xunit.v3.mtp-v2, and xunit.runner.visualstudio.
  • Test Project Configuration: All test projects (.csproj files) now include <OutputType>Exe</OutputType> and reference the new xUnit v3 packages. A global.json entry has been added to configure Microsoft.Testing.Platform as the test runner.
  • Asynchronous API Refactoring: Numerous asynchronous methods across test files, including provider initialization, shutdown, flag resolution, and hook executions, have been updated to explicitly accept and utilize CancellationToken parameters, aligning with modern async patterns and xUnit v3's TestContext.Current.CancellationToken.
  • Test Assertion and Lifecycle Changes: Specific test assertion patterns have been refactored, such as changing Skip.If to Assert.SkipWhen. Additionally, IAsyncLifetime methods (InitializeAsync, DisposeAsync) in test fixtures now return ValueTask instead of Task for improved performance.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully upgrades the test infrastructure to xUnit v3 and Microsoft.Testing.Platform v2. The changes are extensive and consistently applied across all test projects, including updating package versions, project files, and test code to use new APIs and propagate cancellation tokens. This is a solid modernization of the test suite. I have a couple of suggestions to improve test correctness and maintainability.

Comment thread test/OpenFeature.Tests/OpenFeatureTests.cs Outdated
Comment thread test/OpenFeature.Tests/OpenFeatureClientTests.cs
@askpt

askpt commented May 16, 2026

Copy link
Copy Markdown
Member

@benjiro are you still working on this task? The xunit library is now officially deprecated.

@benjiro benjiro force-pushed the feat/xunit-v3-upgrade branch 12 times, most recently from 2192f42 to 3dbf7cc Compare May 23, 2026 12:02
@benjiro benjiro marked this pull request as ready for review May 23, 2026 12:04
Comment thread test/Directory.Build.props
@benjiro benjiro force-pushed the feat/xunit-v3-upgrade branch from 3dbf7cc to 86799c1 Compare May 23, 2026 12:08
@codecov

codecov Bot commented May 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.08%. Comparing base (f875bc3) to head (298db6c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #681      +/-   ##
==========================================
- Coverage   93.52%   93.08%   -0.45%     
==========================================
  Files          69       65       -4     
  Lines        2981     2935      -46     
  Branches      355      355              
==========================================
- Hits         2788     2732      -56     
- Misses        135      140       +5     
- Partials       58       63       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@benjiro benjiro force-pushed the feat/xunit-v3-upgrade branch 9 times, most recently from 3d7842b to 3d1ef7f Compare May 24, 2026 03:10
@benjiro benjiro force-pushed the feat/xunit-v3-upgrade branch 3 times, most recently from 6561390 to 193b7dd Compare May 24, 2026 11:13
@benjiro

benjiro commented May 24, 2026

Copy link
Copy Markdown
Member Author

Had to dust off my old windows box to debug the code coverage issue was a curly one. Seems that GithubActionLogger is interacting with Coverlet. Had to add --coverlet-exclude "[GitHubActionsTestLogger*]*" so Coverlet doesn't try to instrument it. Running dotnet test will run e2e test project since submodule stuff isn't bootstrapped in code coverage workflow had to add --ignore-exit-code 8 not fail on zero test projects

Due to the upgrade to the MTP and coverage system there is a slight discrepancy overall code coverage

@askpt askpt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look into the package I referenced. I believe it can be removed. Other than that, LGTM!

Comment thread Directory.Packages.props Outdated
@toddbaert toddbaert self-requested a review May 25, 2026 19:50
Comment thread .github/workflows/code-coverage.yml Outdated

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @benjiro . Approved with a very small nit.

Consider @askpt 's points.

Signed-off-by: Benjamin Evenson <2031163+benjiro@users.noreply.github.com>
@benjiro benjiro force-pushed the feat/xunit-v3-upgrade branch from 193b7dd to 298db6c Compare May 26, 2026 22:34
@askpt askpt changed the title feat: Upgrade to xUnit v3 and mtp v2 test: Upgrade to xUnit v3 and mtp v2 May 27, 2026
@askpt askpt enabled auto-merge May 27, 2026 06:17
@askpt askpt added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit de64b79 May 27, 2026
24 of 25 checks passed
@askpt askpt deleted the feat/xunit-v3-upgrade branch May 27, 2026 06: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.

Change testing framework to Microsoft Testing Platform (MTP) Upgrade to xUnit v3

3 participants