Testing in Rust
# Map of Rust testing strategies — unit to security — with the built-in harness, nextest, and the deep-dive notes per strategy.
❯ cat documents/
-
Testing in Rust — strategies & tooling map
Concept
2026-08-09
Map of Rust testing strategies — unit to security — built on the built-in test harness and cargo-nextest, with the tools per strategy and links to the deep-dive notes.
-
End-to-end testing — whole systems & contracts
Concept
2026-08-09
E2E in Rust — reqwest smoke suites against deployed services, browser automation with thirtyfour and headless chrome, CLI testing with assert_cmd, and where contract testing stands.
-
Integration testing — tests/, in-process routers & testcontainers
Concept
2026-08-09
The tests/ directory model, driving axum routers in-process with tower::ServiceExt, #[sqlx::test] databases, testcontainers-rs, wiremock for HTTP stubs, and async test mechanics.
-
Mutation testing — cargo-mutants
Concept
2026-08-09
Judging the test suite by mutating the code — cargo-mutants' approach, reading missed-mutant reports, scoping and CI economics, and the type-system twist on mutation in Rust.
-
Performance & load testing — criterion, divan & friends
Concept
2026-08-09
Microbenchmarks with criterion and divan, instruction-count benchmarking with iai-callgrind, black_box discipline, load testing with goose and k6, and wiring benchmarks into CI.
-
Property-based testing & fuzzing — proptest & cargo-fuzz
Concept
2026-08-09
Invariants over generated inputs with proptest (strategies, shrinking, regression files) and coverage-guided fuzzing with cargo-fuzz/libFuzzer and the arbitrary crate — and how the two share targets.
-
Security testing — audit, unsafe hygiene & fuzzing
Concept
2026-08-09
The Rust security-testing portfolio — cargo-audit/deny/vet on the supply chain, cargo-geiger and miri on unsafe code, fuzzing the input surface, and SAST's smaller role.
-
Unit testing — the built-in harness, organization & doubles
Concept
2026-08-09
Rust unit testing with #[test] and #[cfg(test)] modules — assertion macros, rstest parameterization, insta snapshots, doctests, and the trait-based approach to test doubles.