rust-testing

Automate Rust testing workflows with proptest, mockall, criterion, and cargo-nextest.

3|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/yankeeinlondon/rusty-biscuit --skill rust-testing-yankeeinlondon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/yankeeinlondon/rusty-biscuit/tree/main/.claude/skills/rust-testing
Command: npx skills add https://github.com/yankeeinlondon/rusty-biscuit --skill rust-testing-yankeeinlondon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide consolidates patterns, tooling, and best practices to ensure robust Rust software testing across unit, integration, property-based, mocking, and benchmarking scenarios.

Core Features & Use Cases

  • Structured testing approach: guidance for organizing and writing unit tests, integration tests, and property-based tests with proptest.
  • Tooling integration: use of mockall for mocks, criterion for benchmarks, and cargo-nextest for faster, reliable test runs.
  • Use Case: applies to Rust libraries and binaries to validate correctness, performance, and API contracts across development and CI.

Quick Start

Run the full Rust test suite with cargo-nextest to validate unit, integration, and property-based tests.

Frequently Asked Questions about rust-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize Rust unit and integration tests in a project?

Rust testing organizes unit tests within the src directory alongside source modules, and integration tests in a dedicated top-level tests directory. This separation validates module-level logic independently from external API contracts.

What is property-based testing in Rust and how does proptest work?

Property-based testing in Rust validates code correctness by automatically generating varied inputs to verify universal invariants. Using proptest, developers define logical properties rather than fixed examples, exposing hidden edge cases across the generated test cases.

How do I set up mocking in Rust using mockall?

Mocking in Rust using mockall generates mock implementations of traits to isolate components during test execution. Developers apply mockall to define expected method calls and return values, verifying interactions without relying on external dependencies or real side effects.

Does cargo-nextest work with existing Rust test suites?

cargo-nextest works with existing Rust test suites by acting as a faster, more reliable test runner for standard cargo tests. It integrates seamlessly into development and CI workflows to execute unit, integration, and property-based tests with improved parallelism and reporting.

What's the best way to benchmark Rust code performance?

Benchmarking Rust code performance is best handled using criterion, which integrates into the Rust testing workflow to measure execution speed and detect regressions. Criterion provides statistical analysis and detailed reporting to validate performance across development iterations.

Can I run Rust benchmarks and unit tests in the same CI workflow?

Running Rust benchmarks and unit tests in the same CI workflow is fully supported by combining criterion for performance measurement and cargo-nextest for test execution. This setup validates both functional correctness and execution speed across continuous integration pipelines.