Installation
Homebrew (macOS)
Install ttry via the Homebrew tap:
brew install delaudio/tap/ttry
From Source (Cargo)
Build and install using Cargo:
git clone https://github.com/delaudio/ttry.git
cd ttry
cargo install --path .
First Test Suite (ttry.toml)
Create a ttry.toml configuration file in your project:
[suite]
timeout_ms = 5000
reporter = "dot"
[[tests]]
name = "verify help screen"
command = ["./target/debug/my-app", "--help"]
expect_text = "Usage:"
expect_exit = true
Run the test suite:
ttry test
First Rust Integration Test
Add ttry to your Cargo.toml dev-dependencies and launch a session:
use std::time::Duration;
use ttry::{LaunchOptions, TuiSession};
#[test]
fn test_my_tui() -> ttry::Result<()> {
let session = TuiSession::launch(
LaunchOptions::new("./target/debug/my-app")
.arg("--demo")
.size(80, 24),
)?;
session.wait_for_text("Projects", Duration::from_secs(5))?;
session.keyboard().press("q")?;
session.close()?;
Ok(())
}