
Rust Testing
This one walks you through the full TDD cycle in Rust, from basic unit tests with assert macros to property-based testing with proptest and mocking with mockall. It's organized around the RED-GREEN-REFACTOR workflow, so you write failing tests first, implement minimal code to pass, then refactor. The coverage is solid: async tests with tokio, parameterized tests with rstest, integration test structure, and panic testing. If you're coming from other languages and want to see how Rust testing actually works in practice, or you're already writing Rust but want to tighten up your test discipline, this covers the patterns you'll actually use. The code samples are realistic and show both the setup and the assertions you'd write.
- skills.sh installs
- 5.3K
- GitHub stars
- 229.1K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add affaan-m/everything-claude-code --skill rust-testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
Rust Testing Patterns
Comprehensive Rust testing patterns for writing reliable, maintainable tests following TDD methodology.
When to Use
- Writing new Rust functions, methods, or traits
- Adding test coverage to existing code
- Creating benchmarks for performance-critical code
- Implementing property-based tests for input validation
- Following TDD workflow in Rust projects
How It Works
- Identify target code — Find the function, trait, or module to test
- Write a test — Use
#[test]in a#[cfg(test)]module, rstest for parameterized tests, or proptest for property-based tests - Mock dependencies — Use mockall to isolate the unit under test
- Run tests (RED) — Verify the test fails with the expected error
- Implement (GREEN) — Write minimal code to pass
- Refactor — Improve while keeping tests green
- Check coverage — Use cargo-llvm-cov, target 80%+
TDD Workflow for Rust
The RED-GREEN-REFACTOR Cycle
RED → Write a failing test first
GREEN → Write minimal code to pass the test
REFACTOR → Improve code while keeping tests green
REPEAT → Continue with next requirement
Step-by-Step TDD in Rust
Sponsors
Details
- Repository
- github.com/affaan-m/everything-claude-code
- Categories
- Testing & QA, Rust
- First seen
- Apr 16, 2026
More from affaan-m/everything-claude-code
All 256- Ai First Engineering5.2K
- Autonomous Loops5.2K
- Content Engine5.2K
- Content Hash Cache Pattern5.2K
- Kotlin Coroutines Flows5.2K
- Swiftui Patterns5.2K
- Investor Materials5.1K
- Laravel Tdd5.1K
- Regex Vs Llm Structured Text5.1K
- Compose Multiplatform Patterns5K
- Continuous Agent Loop5K
- Foundation Models On Device5K
- Investor Outreach5K
- Kotlin Patterns5K
- Rust Patterns5K
- Swift Actor Persistence5K
- Swift Protocol Di Testing5K
- Bun Runtime4.9K
- Nextjs Turbopack4.9K
- Plankton Code Quality4.9K
- Swift Concurrency 6 24.9K
- Visa Doc Translate4.9K
- Ai Regression Testing4.8K
- Architecture Decision Records4.8K