CheckOps
rstest
rstest is an Apache-2.0 fixture-based and parameterised testing framework for Rust, offering pytest-style fixtures, #[case] tables, value matrices and async support on top of cargo test.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
rstest brings fixtures and table-based tests to Rust, inspired by pytest. It uses procedural macros on top of the standard test harness, so tests still run with cargo test or cargo-nextest.
A function marked #[fixture] provides a reusable value, and any #[rstest] test that names it as an argument receives it automatically, with fixtures able to depend on other fixtures. Parameterised tests use #[case(...)] attributes, each generating a separate named test; #[values(...)] creates a combinatorial matrix; #[once] fixtures are created once for all tests; #[files(...)] generates a test per matching file; and async tests and fixtures are supported with runtimes such as tokio. Timeouts can be set per test, and each generated case gets a descriptive name in test output, which makes failures easy to locate. Version 0.28.0 was released on 18 October 2026.
The source code is at la10736/rstest on GitHub under the Apache-2.0 licence, with about 1,600 stars; the most recent commit was on 18 October 2026.
Features
- Fixtures: Reusable, composable test inputs.
- Case tables:
#[case]creates one test per row. - Value matrices:
#[values]for combinations. - Async and file-based tests: Async support and
#[files]generation.
Pros
- Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 18 October 2026.
Cons
- Macro errors: Compile errors from macros can be confusing.
- Compile time: Many generated tests increase build time.
Usage and Links (Example)
use rstest::*;
#[fixture]
fn cart() -> Cart { Cart::with_items(&[("apple", 2)]) }
#[rstest]
fn counts_items(cart: Cart) {
assert_eq!(cart.len(), 2);
}
#[rstest]
#[case(100, 0, 100)]
#[case(100, 10, 90)]
fn applies_discount(#[case] price: u32, #[case] pct: u32, #[case] want: u32) {
assert_eq!(apply(price, pct), want);
}
Resources:
Pricing
rstest is free and open source under the Apache-2.0 licence.
Recommended for?
- Rust developers wanting pytest-like fixtures and parameterised tests.
- Suites with many similar cases.
Conclusion
rstest makes Rust tests more concise and reusable with fixtures and case tables, while staying within the standard test harness.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with rstest side by side.
Ccargo-nextestcargo-nextest is an Apache-2.0 next-generation test runner for Rust, up to 3x faster than cargo test per its site, with per-test process isolation, retries, partitioning, JUnit output and a filterset DSL.Compare with rstest
Pproptestproptest is a Hypothesis-inspired property-based testing framework for Rust, with composable strategies, automatic shrinking and persisted regression files.Compare with rstest
Iinstainsta is an Apache-2.0 snapshot testing library for Rust by Armin Ronacher, with assert_snapshot! macros, serde-based formats, redactions, inline snapshots and the cargo insta review tool.Compare with rstest
MMockallMockall is a powerful mock object library for Rust, generating mocks for traits and structs with the #[automock] attribute or mock! macro, with expectations, predicates and call counts.Compare with rstest- Ppytestpytest is the usual Python test runner: plain asserts, fixtures, parametrization, and a large plugin set.Compare with rstest
Ccargo-mutantscargo-mutants is an MIT-licensed mutation testing tool for Rust that injects bugs into your code and reports which ones your tests miss, with nextest support, sharding and diff-based runs.Compare with rstest