rust-testing

Identify Rust code targets and structure unit, integration, and property-based tests.

16|3|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/sehoon787/my-claude --skill rust-testing-sehoon787
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rust-testing
Source: https://github.com/sehoon787/my-claude/tree/main/skills/ecc/rust-testing
Command: npx skills add https://github.com/sehoon787/my-claude --skill rust-testing-sehoon787

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Rust testing patterns provide a structured approach to writing unit, integration, async, and property-based tests, enabling TDD-inspired workflows and robust coverage for Rust projects.

Core Features & Use Cases

  • Unit tests with #[test] in a #[cfg(test)] module
  • Integration tests under tests/ with separate binaries
  • Async testing patterns using #[tokio::test] or async tests
  • Property-based testing with proptest
  • Mocking with mockall to isolate units

Quick Start

Write a minimal test to validate a simple function, then progressively add tests as you implement features.

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 unit tests and integration tests in a project?▼

Rust unit tests belong in a #[cfg(test)] module within your source files, while integration tests are placed in a separate tests/ directory to run as independent binaries against your crate's public API.

What's the best way to mock dependencies in Rust testing?▼

Mocking dependencies in Rust testing is done using the mockall crate, which allows you to automatically generate mock implementations for traits to isolate units and verify interactions.

How do I test async Rust code effectively?▼

Async Rust testing is handled using the #[tokio::test] macro, which provides a runtime environment for executing and awaiting asynchronous functions within your test cases.

What is property-based testing in Rust and how do I apply it?▼

Property-based testing in Rust uses the proptest crate to generate arbitrary test inputs, ensuring your code holds true across a wide range of scenarios rather than just predefined cases.

Can I use rstest for parametrized Rust unit tests?▼

Yes, rstest allows you to define parametrized Rust unit tests, enabling you to run the same test logic against multiple inputs and fixtures for comprehensive coverage.

How do I maintain a TDD workflow in Rust?▼

A TDD workflow in Rust is maintained by writing minimal tests using #[test] first, implementing features to pass them, and progressively adding unit, integration, and property-based tests for robust coverage.