rust-testing

Create unit, integration and doc tests for Rust projects using cargo test.

1|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/Zelenov/frename --skill rust-testing-zelenov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/Zelenov/frename/tree/main/.cursor/skills/rust-testing
Command: npx skills add https://github.com/Zelenov/frename --skill rust-testing-zelenov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust projects often suffer from regressions and unclear quality without robust testing. This skill teaches how to implement unit, integration, and doc tests, along with mocking strategies, to ensure code quality and reliable behavior.

Core Features & Use Cases

  • Unit Tests: Validate individual functions and modules with fast, focused checks.
  • Integration & Doc Tests: Ensure end-to-end behavior and keep documentation examples correct.
  • Mocking & TDD: Isolate components with mocks and apply test-driven development across crates.
  • Patterns & Troubleshooting: Provide proven testing patterns for async code, property tests, and common pitfalls.

Quick Start

Create a Rust project, add #[test] unit tests and integration tests, and run cargo test to verify all tests pass.

Frequently Asked Questions about rust-testing

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

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

Rust testing structures unit tests inside source files with #[test] and integration tests in a separate tests directory. This separation isolates fast module checks from end-to-end behavior validation using cargo test.

What is the best way to run doc tests in Rust to keep documentation examples correct?

Doc tests in Rust run code examples embedded in documentation comments via cargo test. They ensure documented usage stays synchronized with actual API behavior and prevents regressions in examples.

How does mocking work when applying test-driven development across Rust crates?

Mocking in Rust test-driven development isolates components using common crates to replace dependencies. This allows focused validation of individual modules without triggering external side effects or requiring full integrations.

Do I need cargo and rustc to set up Rust testing infrastructure?

Yes, Rust testing requires the cargo and rustc toolchain to compile modules and execute tests. Cargo orchestrates the test runs, while rustc handles compilation of unit, integration, and doc tests.

Can I test async code and apply property testing patterns in Rust?

Rust testing supports async code and property tests using common crates. These patterns validate concurrent behavior and generate randomized inputs to prove function correctness across edge cases.