Expand description
Snapshot/golden testing and time-travel debugging for FrankenTUI.
- Snapshot testing: Captures
Bufferoutput as text, compares against stored.snapfiles. - Time-travel debugging: Records compressed frame snapshots for rewind inspection.
Captures Buffer output as plain text or ANSI-styled text, compares
against stored snapshots, and shows diffs on mismatch.
§Role in FrankenTUI
ftui-harness is the verification layer. It powers snapshot tests,
time-travel debugging, and deterministic rendering checks used across the
workspace.
§How it fits in the system
The harness is not the primary demo app (use ftui-demo-showcase for that).
Instead, it is used by tests and CI to validate the behavior of render,
widgets, and runtime under controlled conditions.
§Quick Start
ⓘ
use ftui_harness::{assert_snapshot, MatchMode};
#[test]
fn my_widget_renders_correctly() {
let mut buf = Buffer::new(10, 3);
// ... render widget into buf ...
assert_snapshot!("my_widget_basic", &buf);
}§Updating Snapshots
Run tests with BLESS=1 to create or update snapshot files:
BLESS=1 cargo testSnapshot files are stored under tests/snapshots/ relative to the
crate’s CARGO_MANIFEST_DIR.
Re-exports§
pub use determinism::DeterminismFixture;pub use determinism::JsonValue;pub use determinism::LabScenario;pub use determinism::LabScenarioContext;pub use determinism::LabScenarioResult;pub use determinism::LabScenarioRun;pub use determinism::TestJsonlLogger;pub use determinism::lab_scenarios_run_total;pub use lab_integration::Lab;pub use lab_integration::LabConfig;pub use lab_integration::LabOutput;pub use lab_integration::LabSession;pub use lab_integration::Recording;pub use lab_integration::ReplayResult;pub use lab_integration::assert_outputs_match;pub use lab_integration::lab_recordings_total;pub use lab_integration::lab_replays_total;pub use time_travel_inspector::TimeTravelInspector;pub use benchmark_gate::BenchmarkGate;pub use benchmark_gate::GateResult;pub use benchmark_gate::Measurement;pub use benchmark_gate::MetricVerdict;pub use benchmark_gate::Threshold;pub use rollout_scorecard::RolloutEvidenceBundle;pub use rollout_scorecard::RolloutScorecard;pub use rollout_scorecard::RolloutScorecardConfig;pub use rollout_scorecard::RolloutSummary;pub use rollout_scorecard::RolloutVerdict;pub use shadow_run::ShadowRun;pub use shadow_run::ShadowRunConfig;pub use shadow_run::ShadowRunResult;pub use shadow_run::ShadowVerdict;
Modules§
- artifact_
manifest - Artifact manifests, retention, redaction, and size discipline (bd-2tg0i).
- asciicast
- Asciicast v2 session recording for FrankenTUI.
- baseline_
capture - Deterministic baseline capture for performance measurement (bd-760ih).
- benchmark_
gate - Benchmark gate enforcement with structured evidence.
- buffer
- Buffer grid storage.
- cell
- Cell types and invariants.
- cost_
surface - Render pipeline cost surface mapping (bd-vtor0).
- determinism
- Deterministic fixtures for tests and E2E harnesses.
- doctor_
cost_ profile - Doctor workflow cost profiling (bd-qbbkv).
- doctor_
topology - Doctor supervision topology for Asupersync migration (bd-1889t).
- failure_
signatures - Failure signatures and replay-friendly log quality contracts (bd-xl1c4).
- fixture_
runner - Fixture runner: executes
FixtureSpecworkloads and producesBaselineRecords (bd-muv6p). - fixture_
suite - Deterministic macrobenchmark and replay fixture suites (bd-muv6p).
- flicker_
detection - Flicker/Tear Detection Harness for FrankenTUI.
- frame_
comparison - Golden frame comparison for deterministic replay verification (bd-3mjjt.3).
- golden
- Golden Output Harness for deterministic testing and isomorphism proofs.
- hdd
- Hierarchical Delta Debugging (HDD) for structured inputs.
- hotspot_
extraction - Hotspot extraction and profiling infrastructure (bd-p8i4s).
- input_
storm - Input Storm Generator for Fault Injection Testing (bd-1pys5.1)
- lab_
integration - FrankenLab integration: deterministic model simulation with LabScenario.
- layout_
reuse - Layout and text reuse strategy with strict invalidation contracts (bd-dwrhv).
- optimization_
policy - Optimization admission policy and opportunity scoring (bd-dyr5a).
- presenter_
equivalence - Presenter equivalence rules and state-churn minimization model (bd-ddruy).
- proof_
oracle - Behavior-preservation proof oracles for optimization validation (bd-js3c3).
- proptest_
support - Shared proptest strategies for cross-crate property tests.
- render_
certificate - Render-skip certificate design and correctness model (bd-2dlqr).
- resize_
storm - Resize Storm Generator + Replay Harness (bd-1rz0.15)
- rollout_
runbook - Rollout runbook: executable documentation for the Asupersync migration (bd-132iq).
- rollout_
scorecard - Rollout go/no-go scorecard for the Asupersync migration (bd-2crbt).
- shadow_
run - Shadow-run comparison harness for validating execution-path equivalence.
- terminal_
model - Simplified terminal model for testing presenter output.
- time_
travel - Time-travel debugging with frame snapshots.
- time_
travel_ inspector - Simple debug UI for inspecting TimeTravel recordings.
- trace_
replay - Render-trace replay harness.
- validation_
matrix - Comprehensive validation matrix and logging contract for performance work (bd-pou7j).
Macros§
- assert_
snapshot - Assert that a buffer matches a stored snapshot (plain text).
- assert_
snapshot_ ansi - Assert that a buffer matches a stored ANSI snapshot (with style info).
Structs§
- Profile
Snapshot - Snapshot output captured for a specific profile.
- Rect
- A rectangle for scissor regions, layout bounds, and hit testing.
Enums§
- Match
Mode - Comparison mode for snapshot testing.
- Profile
Compare Mode - Comparison mode for cross-profile output checks.
Functions§
- assert_
buffer_ snapshot - Assert that a buffer’s text representation matches a stored snapshot.
- assert_
buffer_ snapshot_ ansi - Assert that a buffer’s ANSI-styled representation matches a stored snapshot.
- buffer_
to_ ansi - Convert a
Bufferto text with inline ANSI escape codes. - buffer_
to_ text - Convert a
Bufferto a plain text string. - buffer_
to_ text_ with_ pool - Convert a
Bufferto a plain text string, resolving grapheme pool references. - current_
test_ profile - Resolve the active test profile from the environment.
- diff_
text - Compute a simple line-by-line diff between two text strings.
- profile_
matrix_ text - Run a test closure across multiple profiles and optionally compare outputs.
- profile_
matrix_ text_ with_ options - Profile matrix runner with explicit comparison options.