rvtest-0.3.1 has been yanked.
rvtest — A Next Level Testing Library for Rust.
Just a library — not a framework, not a product.
rvtest extends Rust's built-in testing capabilities with a rich suite
of features:
It does not replace #[test] or cargo test. It does not require
you to adopt a new framework or restructure your project. You add it as a
dev-dependency and use it exactly where it helps — nothing more.
- BDD-style specs — organise tests with
describe/itblocks, nested hierarchies, lifecycle hooks (before_all,after_all,before_each,after_each), tags, timeouts, and retries. - Property-based testing — verify invariants over randomly generated inputs, with automatic counterexample shrinking.
- Parametrized tests — run the same test logic against multiple inputs without boilerplate.
- Assertion macros —
assert_eq!with structural diffs,assert_ok!,assert_err!,assert_matches!,assert_delta!. - Mocking utilities —
Spy(call-recording),Stub(fixed return),patch!(scoped function replacement). No proc-macro required. - Snapshot testing — file-based snapshot assertions with
--update-allauto-accept and--reviewinteractive mode. - Architecture tests — enforce module dependency rules
(
may_depend_on,may_not_depend_on,must_not_have_cycles,public_api_doc_required). - Output capture — per-test stdout/stderr capture, shown only on failure.
- Rich reporting — Pretty (human-readable with colour), TAP, JUnit XML, JSON, Compact, GitHub Actions annotations, and Agent-native (LLM-optimised JSON with source snippets).
- Code coverage — measure line/function/region coverage via
pure-Rust
.profrawparser (cargo rvtest --coverage). No external LLVM tools required. Falls back tocargo-llvm-covorllvm-toolswhen available. - Configurable runner — parallel execution, name/tag/skip filtering, fail-fast, configurable timeouts, retries, and execution-order shuffling.
- Flaky quarantine —
--quarantineskips known-flaky tests;--flaky-reportlists them. - Git-aware test selection —
--changedauto-filters tests based ongit diff. - Last-run cache —
--retest/--failedre-runs only previously failed tests;--diffshows new failures, recovered tests, and duration changes. - Environment & filesystem utilities —
rvtest::env(RAII env var guards) andrvtest::fs(auto-cleaning temp directories). - Optional proc-macro API —
#[describe]/#[it]attribute macros via themacrosfeature. - Zero proc-macro deps by default — Everything works with plain
Rust functions and closures inside standard
#[test]functions.
Library API
Use rvtest inside standard #[test] functions:
use rvtest::spec::describe;
#[test]
fn calculator_tests() {
describe("Calculator")
.it("adds two positive numbers", || {
assert_eq!(2 + 2, 4);
})
.it("subtracts", || {
assert_eq!(5 - 3, 2);
})
.tag("arithmetic")
.timeout(std::time::Duration::from_secs(2))
.retries(1)
.run()
.assert_all_pass();
}
CLI (cargo rvtest)
The cargo-rvtest binary (install via cargo install cargo-rvtest)
runs your project's tests via cargo test and renders results in
any supported format. See cargo rvtest --help for all options.
Feature flags
macros— Enables#[describe]/#[it]proc-macro attributes (re-exported fromrvtest-macros).