Skip to content

Add streaming test results support via SSE#21

Open
elpete wants to merge 7 commits intodevelopmentfrom
feature/streaming-test-results
Open

Add streaming test results support via SSE#21
elpete wants to merge 7 commits intodevelopmentfrom
feature/streaming-test-results

Conversation

@elpete
Copy link
Contributor

@elpete elpete commented Mar 3, 2026

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

  • --streaming flag - Enable streaming mode with testbox run --streaming
  • --verbose flag - Show all specs including passing ones (by default, only failures/skipped are persisted)
  • SSEClient.cfc - Consumes SSE stream from TestBox
  • StreamingRenderer.cfc - Renders real-time test progress with ANSI terminal control

Behavior

  • Currently running spec shows with » indicator in yellow
  • Passing specs: Line clears (no trace left) unless --verbose is enabled
  • Failing/Error specs: Persisted with red failure details
  • Skipped specs: Persisted in gray text

Technical Details

  • Uses raw terminal writer to bypass JLine's AttributedString processing (which strips cursor control codes)
  • Proper ANSI sequences: \r + ESC[2K for line clearing
  • Requires both writer.flush() and terminal.flush() for immediate display

Tests

11 unit tests covering:

  • Suite rendering lifecycle
  • Spec states (running, passed, failed, skipped)
  • Verbose mode behavior
  • Nested spec formatting

Related

Usage

# Basic streaming
testbox run --streaming

# Verbose mode (show all specs including passing)
testbox run --streaming --verbose

elpete added 2 commits March 2, 2026 21:34
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
Copy link

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

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 --streaming support to testbox run, switching execution to an SSE-based streaming path.
  • Introduces models/SSEClient.cfc to consume and parse text/event-stream responses.
  • Introduces models/StreamingRenderer.cfc plus 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).

elpete added 4 commits March 9, 2026 18:42
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.
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.

2 participants