testty
testty is a framework for end-to-end testing of terminal apps. It launches your real app and checks what shows up on screen — text, colors, and highlights — with a single Rust API.
Installation
[]
= "0.9"
= "3"
Command-line binary
testty also ships a testty command-line front end so projects in any language — not
just Rust crates — can drive TUI scenarios, generate schemas, and inspect proof
artifacts. Install it with:
testty run [--bin ] [--proof ]
testty schema
testty proof open
testty proof gallery
testty update
run— execute a scenario file against a TUI binary.schema— print the JSON schema for scenario files.proof open— open a single proof report.proof gallery— build a gallery from a directory of proof reports.update— update stored scenario snapshots to match current output.
run executes a YAML scenario against a binary and reports pass/fail through the exit
code (see YAML scenarios). The remaining verbs (schema,
proof open, proof gallery, update) are still stubs: they print a "not yet
implemented" notice and exit non-zero until the behavior is wired up.
Capabilities
Reliable • No flaky tests
- Auto-wait.
wait_for_stable_frameandeventuallywait for the screen to settle before asserting, so you never hard-code sleeps. - Screen-first assertions. Check visible text, colors, and highlighted items, with ready-made helpers for tabs, dialogs, and footers.
- Full isolation. Each test runs your real binary in its own workspace, so tests never bleed into one another.
Proof you can share
- Snapshots. Compare a run against a saved baseline — screen text or pixels.
- Reports. Save what each test saw as plain text, a screenshot, an animated GIF, or a self-contained HTML report.
Examples
Write a test
use Scenario;
use PtySessionBuilder;
Wait for something to appear
use Duration;
use assertion;
use Region;
use Scenario;
let scenario = new
.write_text
.eventually
.capture;
Compare against a saved baseline
use ;
let config = new;
assert_frame_snapshot_matches
.expect;
Save a shareable report
use Path;
use HtmlBackend;
use JunitBackend;
let = scenario.run_with_proof.expect;
report.save.unwrap;
report.save.unwrap;
Run a scenario from YAML — no Rust required
Installing the crate (cargo install testty) provides the testty binary, so projects
in any language can drive TUI scenarios with a YAML file:
# scenario.yaml
session:
bin: ./myapp
size:
steps:
- wait_for_stable_frame:
- press_key: Tab
expect:
- selected_tab: Sessions
The exit code is the pass/fail signal (0 = passed), so it drops straight into any CI.
See YAML scenarios.
Resources
- Getting started — install, write your first test, run it
- Scenarios — describe a sequence of actions and waits
- YAML scenarios — run scenarios from a file with
testty run, no Rust required - Assertions — check text, colors, and highlights on screen
- Snapshots — compare a test against a saved baseline
- Proof pipeline — save what a test saw as text, image, GIF, HTML, or JUnit-XML
- Journeys — reusable building blocks for tests
- Frame diffing — see what changed between two screens
- Examples — runnable example programs
- Upgrading — version migration notes
- API reference — full generated docs
License
Apache-2.0. See LICENSE.