CheckOps home

Tools directory

R

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.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

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

  1. Fixtures: Reusable, composable test inputs.
  2. Case tables: #[case] creates one test per row.
  3. Value matrices: #[values] for combinations.
  4. Async and file-based tests: Async support and #[files] generation.

Pros

  1. Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 18 October 2026.

Cons

  1. Macro errors: Compile errors from macros can be confusing.
  2. Compile time: Many generated tests increase build time.
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.

  1. Rust developers wanting pytest-like fixtures and parameterised tests.
  2. 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.