Refactor AppTestHelper to use RunAsync#5267
Conversation
Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/259ae3cf-ff29-45bc-83a9-ba299adadaff Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/259ae3cf-ff29-45bc-83a9-ba299adadaff Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/259ae3cf-ff29-45bc-83a9-ba299adadaff Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/259ae3cf-ff29-45bc-83a9-ba299adadaff Co-authored-by: tig <585482+tig@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/259ae3cf-ff29-45bc-83a9-ba299adadaff Co-authored-by: tig <585482+tig@users.noreply.github.com>
There was a problem hiding this comment.
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
RunAsyncwith 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. |
|
@copilot see CR feedback and addrss. |
|
@copilot see CR feedback and address. |
1 similar comment
|
@copilot see CR feedback and address. |
Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/d5ca1a27-c203-4ff2-9a39-cbbe1beca629 Co-authored-by: tig <585482+tig@users.noreply.github.com>
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.
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. |
Fixes
Proposed Changes/Todos
AppTestHelpercould hang or swallow failures because it ran apps with blockingRunplus separate timeout handling. This refactors the helper to rely onIApplication.RunAsynccancellation semantics.IApplication.RunAsyncwith the helper’s linked cancellation tokenRunAsynccompletes as canceledWaitIterationobserve timeout/hard-stop cancellationPull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)