Skip to main content
Headless simulation replays TUI sessions for CI and automated UI testing.
The user runs headless simulation to script keyboard input and assert on TUI behaviour without a display.

TUI Simulation

The TUI simulation system enables headless testing of TUI behaviors without launching the interactive interface. This is essential for CI/CD pipelines and automated testing.

Overview

The simulation system provides:
  • Headless execution - Run TUI flows without interactive UI
  • Mock provider - Deterministic responses for testing
  • Event capture - Record and replay TUI events
  • Assertions - Validate expected states and transitions
  • JSONL logging - Structured event logs for analysis

Quick Start

1

Run a simulation script

2

Use the orchestrator in Python

Python Usage

TuiOrchestrator

The TuiOrchestrator provides unified event handling for both TUI and headless modes.

SimulationRunner

Run scripted simulations with assertions.

Simulation Script Format

Scripts can be YAML or JSON:

MockProvider

Use the mock provider for deterministic testing.

UIStateModel

The state model tracks all UI state for snapshots.

CLI Usage

Run Simulation

Get Snapshot

Trace Events

Event Types

The simulation system captures these event types:

JSONL Event Format

Events are logged in JSONL format:

Best Practices

Avoid real API calls in automated tests — deterministic mocks keep pipelines fast and free.
Reproducible simulations make flaky test investigation straightforward.
Validate expected events in scripts, not just final stdout text.
Test tool failures and cancellation paths, not only happy-path prompts.

TUI Commands

simulate, snapshot, and trace commands

TUI Overview

Interactive terminal interface