rust-testing

Create Rust unit, integration, async, and property-based tests with Cargo.

1|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/xxih/ai-harness-zh --skill rust-testing-xxih
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/xxih/ai-harness-zh/tree/main/references/translations/everything-claude-code/docs/zh-CN/skills/rust-testing
Command: npx skills add https://github.com/xxih/ai-harness-zh --skill rust-testing-xxih

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many Rust developers lack a unified, TDD‑driven testing workflow, leading to flaky code and low test coverage.

Core Features & Use Cases

  • Comprehensive guidance for unit, integration, async, and property‑based testing in Rust.
  • Strategies for mocking dependencies and measuring test coverage with cargo‑llvm‑cov.
  • Practical examples for building reliable Rust applications, such as a user management library or a web service.

Quick Start

Run cargo test in your Rust project to execute all tests and generate coverage reports.

Frequently Asked Questions about rust-testing

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

FAQPage Schema
How do I set up Rust testing with TDD to improve code reliability?

Rust testing with TDD involves writing unit, integration, async, and property-based tests to catch bugs early. You use the Rust toolchain and Cargo to execute tests and generate coverage reports with cargo-llvm-cov.

What is the best way to mock dependencies in Rust tests?

Mocking dependencies in Rust tests is done using the mockall crate. This allows you to isolate components and simulate interactions, ensuring robust code without relying on actual external services.

How do I measure Rust test coverage using cargo-llvm-cov?

Rust test coverage is measured using cargo-llvm-cov to generate detailed reports. Running cargo test alongside this crate identifies untested code paths, helping you improve your overall coverage.

Does this Rust testing workflow support async and property-based testing?

Rust testing workflows support both async and property-based testing. By utilizing crates like rstest and proptest, you can validate complex logic and asynchronous operations for robust applications.

Do I need specific testing crates to run integration tests in Rust?

Integration tests in Rust are managed via Cargo and enhanced with specific crates like rstest and proptest. These provide structured testing capabilities for building reliable Rust applications.