Fixes #4787. Upgrade all nuget packages including the obsolete xunit v2#4788
Fixes #4787. Upgrade all nuget packages including the obsolete xunit v2#4788tig merged 33 commits intogui-cs:v2_developfrom
Conversation
…emove using Xunit.Abstractions
|
This is clearly not ready. Why does it touch 190 files? |
|
Not a fan of "Rename TestContext to FluentTestContext". I chose TextContext carefully. It actually only enabls Fluent sytle as a side-effect. |
Most of the files have been modified because the |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2_develop #4788 +/- ##
==============================================
- Coverage 77.62% 0.00% -77.63%
==============================================
Files 463 463
Lines 45679 45679
Branches 6815 6815
==============================================
- Hits 35458 0 -35458
- Misses 8233 45679 +37446
+ Partials 1988 0 -1988
... and 436 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
The name isn't the issue, it can be whatever you want. What's unacceptable is continuing to call it TestContext because xunit.v3 already contains an object with the same name, which creates a conflict. Everything worked fine on my machine. I don't understand why. |
|
Would probably fixes the #4569? |
xUnit v3 replaced VSTest with Microsoft Testing Platform (MTP), but
the migration removed the VSTest adapter packages without adding the
MTP configuration. This broke both `dotnet test` (no tests discovered)
and ReSharper test discovery.
- Add `"test": { "runner": "Microsoft.Testing.Platform" }` to
global.json so `dotnet test` uses MTP (xUnit v3's native runner)
- Add Microsoft.NET.Test.Sdk and xunit.runner.visualstudio packages
for backward compatibility with IDEs using VSTest (ReSharper, VS
Test Explorer), per xUnit v3 migration guidance
- Add `<IsTestProject>true</IsTestProject>` to all test projects so
the .NET SDK and IDEs recognize them as test projects
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I had to remove them all, otherwise it caused errors in the CI pipelines. |
You got rid of the errors in the CI pipelines because no tests were being run! I'm fixing this now. |
xUnit v3 uses MTP instead of VSTest. Update all test workflows to use the MTP-compatible `dotnet test` syntax: - Use `--project` flag instead of positional path argument - Replace `--diag` with `--diagnostic-output-directory` - Replace `--collect:"XPlat Code Coverage" --settings` with `--coverage` - Remove VSTest-specific flags: `--blame`, `--blame-crash`, `--blame-hang`, `--blame-hang-timeout`, `--blame-crash-collect-always` - Remove `-- xUnit.*` pass-through args (not supported in MTP) - Remove `VSTEST_DUMP_PATH` env var and VSTest process exclusions - Update README to reflect MTP changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sorry, I didn't even notice that. Thanks. xunit.v3 now creates executable files (.exe) for Windows and files without an extension for Linux/Mac. |
xUnit v3 test projects are standalone executables. On Linux/macOS, the app host binaries lose execute permissions when uploaded/downloaded as build artifacts, causing "Permission denied" when MTP tries to launch them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The --coverage flag requires Microsoft.Testing.Extensions.CodeCoverage which is not included. Remove coverage collection and the Linux-only branching it required. Also remove Codecov upload steps (coverage can be re-added later with a compatible solution). Fix missing chmod step in parallel_unittests job. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MTP runs the native app host executable directly (unlike VSTest which used dotnet exec on the .dll). Linux-built app hosts can't run on macOS/Windows, causing "Exec format error". Each OS now builds its own binaries instead of downloading shared artifacts from a single Linux build. This removes the quick-build dependency, artifact download, and chmod workarounds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Ok, I think this is good now. You should double check my work. |
There was a problem hiding this comment.
Pull request overview
Upgrades the repo’s NuGet dependencies (notably moving from xUnit v2 → xUnit v3) and updates the test/tooling infrastructure to match, including renaming the fluent testing helper library and adjusting CI workflows.
Changes:
- Migrate test projects and helper attributes to xUnit v3 APIs and update many tests accordingly.
- Rename/move fluent testing helpers to
AppTestHelpers(+ generator + integration test updates). - Update CLI parsing in examples (System.CommandLine) and simplify GitHub Actions test workflows.
Reviewed changes
Copilot reviewed 210 out of 213 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| global.json | Adds test runner configuration (Microsoft.Testing.Platform). |
| Directory.Packages.props | Updates central package versions (xUnit v3, tooling, logging, etc.). |
| .github/workflows/unit-tests.yml | Switches CI to build in-job and run tests with diagnostic output. |
| .github/workflows/stress-tests.yml | Updates stress test invocation and diagnostic collection. |
| .github/workflows/integration-tests.yml | Updates integration test invocation and diagnostic collection. |
| .github/workflows/README.md | Updates workflow documentation to match new invocation patterns. |
| Terminal.sln | Renames solution projects to AppTestHelpers*. |
| Terminal.Gui/Terminal.Gui.csproj | Updates InternalsVisibleTo to the renamed helper assembly. |
| Terminal.Gui/Drivers/UnixDriver/UnixClipboard.cs | Converts ctor body to expression-bodied assignment. |
| Terminal.Gui/Drivers/Input/IInput.cs | Updates docs to reference AppTestHelper. |
| Terminal.Gui/App/Clipboard/ClipboardProcessRunner.cs | Adds early-return behavior when console I/O is redirected. |
| Examples/UICatalog/UICatalog.cs | Migrates System.CommandLine setup/handlers to newer APIs. |
| Examples/UICatalog/Scenarios/Editor.cs | Switches checkbox handlers from ValueChanging to ValueChanged and adjusts culture changes. |
| Examples/ScenarioRunner/Program.cs | Migrates ScenarioRunner CLI to newer System.CommandLine APIs. |
| Examples/ReactiveExample/Program.cs | Reworks ReactiveUI setup to use builder API. |
| Examples/ReactiveExample/LoginView.cs | Uses scheduler from builder rather than RxApp.MainThreadScheduler. |
| Tests/UnitTestsParallelizable/UnitTests.Parallelizable.csproj | Updates packages to xUnit v3 + runner, adjusts test project properties and references. |
| Tests/UnitTests/UnitTests.csproj | Updates packages to xUnit v3 + runner, adjusts test project properties and references. |
| Tests/IntegrationTests/IntegrationTests.csproj | Updates packages and references to AppTestHelpers*. |
| Tests/StressTests/StressTests.csproj | Updates packages to xUnit v3 and adjusts test project settings. |
| Tests/TerminalGuiFluentTestingXunit/XunitContextExtensions.cs | Moves xUnit fluent helper extensions into AppTestHelpers.XunitHelpers. |
| Tests/TerminalGuiFluentTestingXunit/TerminalGuiFluentTestingXunit.csproj | Renames/moves project references and updates packages (xUnit v3). |
| Tests/TerminalGuiFluentTestingXunit.Generator/TheGenerator.cs | Updates generator namespaces/usings and generated method bodies for renamed helper context. |
| Tests/TerminalGuiFluentTesting/With.cs | Renames namespace/types from TerminalGuiFluentTesting → AppTestHelpers. |
| Tests/TerminalGuiFluentTesting/ThreadSafeStringWriter.cs | Renames namespace to AppTestHelpers. |
| Tests/TerminalGuiFluentTesting/TextWriterLoggerProvider.cs | Renames namespace to AppTestHelpers. |
| Tests/TerminalGuiFluentTesting/TextWriterLogger.cs | Renames namespace to AppTestHelpers. |
| Tests/TerminalGuiFluentTesting/TestDriver.cs | Renames namespace to AppTestHelpers. |
| Tests/TerminalGuiFluentTesting/TestContext.cs | Renames TestContext → AppTestHelper and adjusts fluent API return types. |
| Tests/TerminalGuiFluentTesting/TestContext.ViewBase.cs | Updates partial class + fluent method return types to AppTestHelper. |
| Tests/TerminalGuiFluentTesting/TestContext.Navigation.cs | Updates partial class + fluent method return types to AppTestHelper. |
| Tests/TerminalGuiFluentTesting/TestContext.Input.cs | Updates partial class + fluent method return types to AppTestHelper. |
| Tests/TerminalGuiFluentTesting/TestContext.ContextMenu.cs | Updates partial class + fluent method return types to AppTestHelper. |
| Tests/IntegrationTests/FluentTests/TreeViewTests.cs | Updates integration tests to use AppTestHelper and new helper namespaces. |
| Tests/IntegrationTests/FluentTests/TextFieldTests.cs | Updates integration tests to use AppTestHelper and new helper namespaces. |
| Tests/IntegrationTests/FluentTests/TestContextTests.cs | Updates integration tests/docs to AppTestHelper. |
| Tests/IntegrationTests/FluentTests/TestContextMouseEventTests.cs | Updates integration tests/docs to AppTestHelper. |
| Tests/IntegrationTests/FluentTests/TestContextKeyEventTests.cs | Updates integration tests/docs to AppTestHelper. |
| Tests/IntegrationTests/FluentTests/PopverMenuTests.cs | Updates integration tests to use AppTestHelper and new helper namespaces. |
| Tests/IntegrationTests/FluentTests/NavigationTests.cs | Updates integration tests to use AppTestHelper. |
| Tests/IntegrationTests/FluentTests/MenuBarTests.cs | Updates integration tests to use AppTestHelper and new helper namespaces. |
| Tests/IntegrationTests/FluentTests/LinearRangeFluentTests.cs | Updates integration tests to use AppTestHelper. |
| Tests/IntegrationTests/FluentTests/FileDialogTests.cs | Updates integration tests to use AppTestHelper and new helper namespaces. |
| Tests/UnitTestsParallelizable/TestDateAttribute.cs | Migrates BeforeAfterTestAttribute usage to xUnit v3 signature. |
| Tests/UnitTests/TestRespondersDisposedAttribute.cs | Migrates BeforeAfterTestAttribute usage to xUnit v3 signature. |
| Tests/UnitTests/SetupFakeApplicationAttribute.cs | Migrates BeforeAfterTestAttribute usage to xUnit v3 signature. |
| Tests/UnitTests/AutoInitShutdownAttribute.cs | Migrates BeforeAfterTestAttribute usage to xUnit v3 signature. |
| Tests/UnitTests/Views/TextViewTests.cs | Updates xUnit attribute hooks to xUnit v3 signatures. |
| Tests/UnitTests/Views/TextFieldTests.cs | Updates xUnit attribute hooks to xUnit v3 signatures. |
| Tests/UnitTests/Views/LabelTests.cs | Updates nullability for Record.Exception result. |
| Tests/UnitTestsParallelizable/** (many files) | Primarily removes Xunit.Abstractions usings and updates async/task usage to flow cancellation tokens via TestContext.Current.CancellationToken. |
Comments suppressed due to low confidence (2)
Tests/UnitTestsParallelizable/ViewBase/Keyboard/AutoHotKeyAssignmentTests.cs:1
- This test mutates
Thread.CurrentThread.CurrentUICulturebut doesn’t restore it. In a parallel test suite, that can leak state into other tests running on the same thread later. Wrap the change in atry/finally(restore previous culture), or use a scoped helper/attribute that guarantees restoration.
Tests/UnitTests/UnitTests.csproj:1 xunit.runner.visualstudiois usually marked withPrivateAssets="all"(and a constrainedIncludeAssets) to avoid it flowing transitively and to keep it clearly test-only. Consider restoring the previousPrivateAssets/IncludeAssetsblock (same applies to other test projects updated similarly).
Update dotnet test commands across all documentation to use --project flag (required by Microsoft Testing Platform). Also update README to reflect per-OS builds and replace --blame references with --diagnostic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix:
|
- Fix duplicate --diagnostic in stress-tests.yml - Update CONTRIBUTING.md, testing-patterns.md, and pr-workflow.md to note that coverage collection is temporarily disabled during the xUnit v3 / MTP migration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cross all projects.
BDisp
left a comment
There was a problem hiding this comment.
Well done. Thanks for your help.
Thank you for taking this on... getting to xunit3 felt daunting to me. It's great having it done. |

Fixes
Proposed Changes/Todos
Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)