← ClaudeAtlas

rust-testinglisted

Behavior. Use when writing or reviewing Rust service tests and the observable failure, the deterministic control, or the smallest proving layer is not obvious.
Dankosik/rust-service-template-rest · ★ 0 · Testing & QA · score 70
Install: claude install-skill Dankosik/rust-service-template-rest
# Rust Testing **Behavior first.** Identify the observable promise a change could break, then choose the smallest layer that can watch it fail. Derive expectations from accepted behavior, not from the implementation's current output. Honor supplied requirements and preserve settled choices outside the requested change; resolve only what the task leaves open. The proving layers in this workspace, smallest first: a unit test beside the owner; the mounted router through a one-shot call, asserting status, content type, problem code, and headers; the bounded server on an ephemeral loopback port for connection behavior; and the built binary in the service crate's integration tests for lifecycle, exit codes, and standard error. Use the smallest layer whose failure would actually distinguish the defect. A status-only assertion proves neither order nor fallback, a passing compile proves no behavior, and a leaf handler called directly omits the chain. Control time and scheduling. Start the test with a paused clock and advance it explicitly for anything that ticks or expires, which requires the code under test to use tokio's Instant. Synchronize on a watch change, a notify, or a joined task, never on a sleep. Bound every wait with a timeout so a hang fails instead of stalling the suite. For process tests, send SIGTERM through the nix signal call, because the child kill method sends SIGKILL, and only after readiness has been observed; always wait the child. Keep fixtures small and in