Skip to content

Refactor AppTestHelper to use RunAsync#5267

Merged
tig merged 7 commits into
developfrom
copilot/refactor-apptesthelper-runasync
May 15, 2026
Merged

Refactor AppTestHelper to use RunAsync#5267
tig merged 7 commits into
developfrom
copilot/refactor-apptesthelper-runasync

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Fixes

Proposed Changes/Todos

AppTestHelper could hang or swallow failures because it ran apps with blocking Run plus separate timeout handling. This refactors the helper to rely on IApplication.RunAsync cancellation semantics.

  • Use IApplication.RunAsync with the helper’s linked cancellation token
  • Ensure runnable and application cleanup runs even when RunAsync completes as canceled
  • Make WaitIteration observe timeout/hard-stop cancellation
  • Preserve and rethrow UI-thread action exceptions
  • Add focused integration coverage for post-startup cancellation and action failure propagation
  • Update quit-key coverage to assert after stop propagation

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

Copilot AI assigned Copilot and tig May 8, 2026
Copilot AI linked an issue May 8, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Refactor AppTestHelper to leverage IApplication.RunAsync Refactor AppTestHelper to use RunAsync May 8, 2026
Copilot finished work on behalf of tig May 8, 2026 04:01
Copilot AI requested a review from tig May 8, 2026 04:01
@tig tig marked this pull request as ready for review May 14, 2026 14:13
@tig tig requested review from BDisp, Copilot and tznind May 14, 2026 14:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the integration test AppTestHelper to run applications through IApplication.RunAsync, improving cancellation behavior and exception propagation in fluent UI tests.

Changes:

  • Adds configurable helper timeouts through With.A(...).
  • Switches app execution to RunAsync with the helper’s linked cancellation token.
  • Adds focused tests for timeout shutdown, action exception propagation, and quit-key stop propagation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Tests/AppTestHelpers/AppTestHelper.cs Refactors background app execution and WaitIteration exception/cancellation handling.
Tests/AppTestHelpers/With.cs Adds optional timeout forwarding to helper factory methods.
Tests/IntegrationTests/FluentTests/TestContextTests.cs Adds coverage for timeout-driven shutdown and action exception propagation.
Tests/IntegrationTests/FluentTests/TestContextKeyEventTests.cs Updates quit-key test to wait for stop propagation.

Comment thread Tests/IntegrationTests/FluentTests/TestContextTests.cs Outdated
Comment thread Tests/AppTestHelpers/AppTestHelper.cs Outdated
@tig
Copy link
Copy Markdown
Member

tig commented May 15, 2026

@copilot see CR feedback and addrss.

@tig
Copy link
Copy Markdown
Member

tig commented May 15, 2026

@copilot see CR feedback and address.

1 similar comment
@tig
Copy link
Copy Markdown
Member

tig commented May 15, 2026

@copilot see CR feedback and address.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 15, 2026

@copilot see CR feedback and addrss.

Addressed the CR feedback in e4a7ca8: RunAsync cleanup now happens in a finally path, and the cancellation test now cancels after helper startup instead of using a tiny startup timeout.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 15, 2026

@copilot see CR feedback and address.

Already addressed in e4a7ca8: RunAsync cleanup is now in a finally path, and the cancellation test cancels after helper startup instead of using a tiny startup timeout.

@copilot see CR feedback and address.

Already addressed in e4a7ca8: RunAsync cleanup is now in a finally path, and the cancellation test cancels after helper startup instead of using a tiny startup timeout.

Copilot finished work on behalf of tig May 15, 2026 20:21
Copilot finished work on behalf of tig May 15, 2026 20:29
@tig tig merged commit 1301e51 into develop May 15, 2026
15 checks passed
@tig tig deleted the copilot/refactor-apptesthelper-runasync branch May 15, 2026 20:34
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.

Refactor AppTestHelper to leverage IApplication.RunAsync

4 participants