rust-testing

Implement Rust unit, integration, async, and property-based tests with cargo test, proptest, and mockall.

3|2|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/agentmatters/mullai-bot --skill rust-testing-agentmatters
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/agentmatters/mullai-bot/tree/main/src/Mullai.Skills/Skills/claude-code-everything/rust-testing
Command: npx skills add https://github.com/agentmatters/mullai-bot --skill rust-testing-agentmatters

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust projects often struggle to establish reliable, maintainable test suites that cover unit, integration, async, property-based, and mocking scenarios. This skill consolidates common Rust testing patterns to help teams implement rigorous validation early and continuously.

Core Features & Use Cases

  • Comprehensive testing patterns for Rust, including unit tests with #[test], integration tests across crates, and async tests.
  • Property-based testing with proptest and mocking with mockall, enabling robust input variation and isolation.
  • Guides for a TDD workflow (RED-GREEN-REFACTOR) to improve code quality and confidence before implementation.

Quick Start

Use Rust testing patterns to implement unit, integration, async, and property-based tests following TDD in your project.

Frequently Asked Questions about rust-testing

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

FAQPage Schema
How do I structure Rust integration tests across crates using cargo test?

Rust integration tests should be placed in a top-level tests directory to validate public interfaces across crates. Running cargo test executes both unit and integration tests, ensuring modules interact correctly and maintain robust error handling.

What's the best way to mock dependencies in Rust async tests?

Mocking dependencies in Rust async tests is best handled with the mockall crate. It allows you to isolate specific components by generating mock implementations, ensuring your async tests remain focused and reliable without external side effects.

How does property-based testing in Rust work with proptest?

Property-based testing with proptest generates varied inputs automatically to validate that code properties hold true universally. Instead of writing individual cases, you define logical invariants and proptest attempts to falsify them, catching edge cases.

Can I follow a TDD workflow with RED-GREEN-REFACTOR in Rust?

Yes, you can follow a TDD workflow in Rust by writing failing tests first (RED), implementing minimal code to pass them (GREEN), and then refactoring. This approach improves code quality and confidence before full implementation.

What tools do I need to measure code coverage for Rust testing patterns?

To measure code coverage for Rust testing patterns, you need cargo-llvm-cov. It integrates with cargo test to generate detailed coverage reports, helping identify untested code paths and ensuring your unit and integration tests are comprehensive.

Why should I use property-based testing instead of standard unit tests in Rust?

Property-based testing discovers edge cases that standard unit tests miss by generating hundreds of input variations automatically. While unit tests check specific scenarios, property-based testing validates logical invariants across a broader input space.