Add streaming test results support via SSE#21
Open
elpete wants to merge 7 commits intodevelopmentfrom
Open
Conversation
Implement real-time test progress streaming using Server-Sent Events for immediate feedback during test execution instead of waiting for completion. - Add SSEClient.cfc for consuming SSE streams from TestBox - Add StreamingRenderer.cfc for real-time CLI output of test events - Update run.cfc with --streaming flag to enable streaming mode - Compatible with outputFormats for generating multiple report files Usage: testbox run --streaming
- Add terminal.flush() after writer.flush() for immediate display - Use raw terminal writer to bypass AttributedString ANSI processing - Change skipped specs color from blue to gray - Add ANSI escape codes for carriage return and clear line - Add comprehensive tests for StreamingRenderer behavior - Running spec indicator (») now shows in yellow during test execution - Passing specs clear the line without leaving a trace - Failed/errored/skipped specs persist with details
There was a problem hiding this comment.
Pull request overview
Adds real-time streaming test output to the TestBox CLI by consuming TestBox SSE events and rendering in-progress spec status directly to the terminal.
Changes:
- Adds
--streamingsupport totestbox run, switching execution to an SSE-based streaming path. - Introduces
models/SSEClient.cfcto consume and parsetext/event-streamresponses. - Introduces
models/StreamingRenderer.cfcplus unit tests to render live spec progress and final summaries.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
commands/testbox/run.cfc |
Adds --streaming flag and runStreaming() flow that consumes SSE and renders streaming + final summary. |
models/SSEClient.cfc |
Implements an SSE consumer over java.net.URLConnection and dispatches parsed events to handlers. |
models/StreamingRenderer.cfc |
Provides event handler closures that render real-time progress and persisted failures/skips. |
tests/specs/StreamingRendererTest.cfc |
Adds unit coverage for streaming renderer behaviors (verbose/non-verbose, statuses, indicators, colors). |
Pass data.totalSkipped to getAggregatedColor so bundles with only skipped specs show SKIP color instead of PASS color.
Flush both termWriter and terminal when clearing the running spec line, matching the behavior in specStart.
…line - Move reader/inputStream/connection close to finally block for proper cleanup - Add connection.disconnect() for complete resource cleanup - Process any buffered event if stream ends without trailing blank line
Ensures CI can detect streaming failures (connection errors, etc.) by setting streamingError flag in onError callback and including it in the exit code check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for consuming streaming test results from TestBox via Server-Sent Events (SSE), providing real-time test progress display in the CLI.
Features
--streamingflag - Enable streaming mode withtestbox run --streaming--verboseflag - Show all specs including passing ones (by default, only failures/skipped are persisted)Behavior
»indicator in yellow--verboseis enabledTechnical Details
\r+ESC[2Kfor line clearingwriter.flush()andterminal.flush()for immediate displayTests
11 unit tests covering:
Related
Usage