Skip to content

test(xUnit): upgrade to v3#8164

Merged
ArgoZhang merged 8 commits into
mainfrom
test-v3
Jun 26, 2026
Merged

test(xUnit): upgrade to v3#8164
ArgoZhang merged 8 commits into
mainfrom
test-v3

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Jun 26, 2026

Copy link
Copy Markdown
Member

Link issues

fixes #8163

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add cancellation token support to various services and tests to align with updated async APIs and improve test reliability.

Enhancements:

  • Unify WebClientService client info retrieval into a single method with an optional cancellation token parameter.
  • Prepare test zip files within ZipArchiveService tests to remove cross-test dependencies.
  • Initialize navigation state in layout-related tests to ensure routing-dependent components render correctly.

Tests:

  • Update unit tests across services and components (Bluetooth, Serial, Clipboard, Ajax, ZipArchive, Throttle, Timer, etc.) to pass CancellationToken parameters and accommodate revised async signatures.

@bb-auto bb-auto Bot added the test This is unit test label Jun 26, 2026
@bb-auto bb-auto Bot added this to the v10.7.0 milestone Jun 26, 2026
@sourcery-ai

sourcery-ai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Updates unit tests and supporting code to be compatible with xUnit v3 and new async APIs by threading CancellationToken parameters through test calls, consolidating WebClientService.GetClientInfo overloads, and strengthening a few tests to be more isolated and deterministic.

File-Level Changes

Change Details Files
Propagate CancellationToken parameters through async service and component tests to match updated method signatures.
  • Update Bluetooth-related tests to pass CancellationToken.None into RequestDevice, connect/read/notification APIs, and availability/device-info methods.
  • Update Throttle tests to pass CancellationToken into Throttle/ThrottleAsync, and use Task.Delay overloads that accept a CancellationToken.
  • Update ZipArchiveService tests to pass CancellationToken into archive/extract APIs, and use cancellation-aware async helpers in tests.
  • Update various component and service tests (ContextMenu, Search, Swal, Ajax, Display, Timer, Clipboard, Serial, BrowserFinger, EyeDropper, Table, TreeView, Validate, ConnectionHub, CountButton, Recognizer, etc.) to pass CancellationToken.None to async methods and Task.Run/Task.Delay where required.
test/UnitTest/Services/BluetoothServiceTest.cs
test/UnitTest/Services/ThrottleTest.cs
test/UnitTest/Services/ZipArchiveServiceTest.cs
test/UnitTest/Components/CountButtonTest.cs
test/UnitTest/Services/ClipboardServiceTest.cs
test/UnitTest/Services/SerialServiceTest.cs
test/UnitTest/Components/ContextMenuTest.cs
test/UnitTest/Components/SearchTest.cs
test/UnitTest/Components/SwalTest.cs
test/UnitTest/Services/ConnectionHubTest.cs
test/UnitTest/Services/WebClientServiceTest.cs
test/UnitTest/Components/AjaxTest.cs
test/UnitTest/Components/DisplayTest.cs
test/UnitTest/Components/LayoutTest.cs
test/UnitTest/Components/RecognizerTest.cs
test/UnitTest/Components/TimerTest.cs
test/UnitTest/Services/BrowserFingerServiceTest.cs
test/UnitTest/Components/SelectGenericTest.cs
test/UnitTest/Components/SelectTest.cs
test/UnitTest/Components/TableTest.cs
test/UnitTest/Components/TreeViewTest.cs
test/UnitTest/Components/ValidateTest.cs
test/UnitTest/Services/EyeDropperServiceTest.cs
Simplify WebClientService client info retrieval API by using a single GetClientInfo overload with an optional CancellationToken parameter.
  • Remove the parameterless GetClientInfo() wrapper method.
  • Change GetClientInfo(CancellationToken token) to use an optional CancellationToken parameter with a default value, and adjust usages in tests to pass a token explicitly.
src/BootstrapBlazor/Services/WebClientService.cs
test/UnitTest/Services/WebClientServiceTest.cs
Make selected tests more deterministic and self-contained to avoid inter-test dependencies and navigation assumptions.
  • In ZipArchiveServiceTest.ZipArchive_Ok, create the folder and seed file (1.txt) within the test itself before creating the zip entry.
  • In LayoutTest, explicitly navigate the BunitNavigationManager to a non-existent route before rendering auth-related layouts to control routing state.
test/UnitTest/Services/ZipArchiveServiceTest.cs
test/UnitTest/Components/LayoutTest.cs
Update test project configuration to align with xUnit v3 (package and build configuration changes).
  • Adjust shared test Directory.Build.props as needed for xUnit v3 configuration (e.g., analyzers, runner behavior).
  • Update UnitTest.csproj references and settings for xUnit v3 (package versions, test SDK integration, or related configuration).
test/Directory.Build.props
test/UnitTest/UnitTest.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#8163 Update the test project configuration and dependencies to use xUnit v3 instead of xUnit v2.
#8163 Refactor existing unit tests and related code to be compatible with xUnit v3 APIs and patterns (e.g., updated async signatures, cancellation token usage).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

bb-auto[bot]
bb-auto Bot previously approved these changes Jun 26, 2026

@bb-auto bb-auto 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.

Auto approved by bb-auto

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

bb-auto[bot]
bb-auto Bot previously approved these changes Jun 26, 2026

@bb-auto bb-auto 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.

Auto approved by bb-auto

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.79%. Comparing base (2bc2722) to head (d62630f).

Additional details and impacted files
@@             Coverage Diff             @@
##              main    #8164      +/-   ##
===========================================
- Coverage   100.00%   98.79%   -1.21%     
===========================================
  Files          766      766              
  Lines        34225    34224       -1     
  Branches      4699     4699              
===========================================
- Hits         34225    33812     -413     
- Partials         0      412     +412     
Flag Coverage Δ
BB 98.79% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

bb-auto[bot]
bb-auto Bot previously approved these changes Jun 26, 2026

@bb-auto bb-auto 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.

Auto approved by bb-auto

@bb-auto bb-auto 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.

Auto approved by bb-auto

@bb-auto bb-auto 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.

Auto approved by bb-auto

@ArgoZhang ArgoZhang enabled auto-merge (squash) June 26, 2026 00:22
@ArgoZhang ArgoZhang disabled auto-merge June 26, 2026 00:35
@ArgoZhang ArgoZhang merged commit c3e9449 into main Jun 26, 2026
6 of 7 checks passed
@ArgoZhang ArgoZhang deleted the test-v3 branch June 26, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test This is unit test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(xUnit): upgrade to v3

1 participant