Skip to content
affaan-m avatar

Rust Testing

Rust testing patterns covering unit, integration, async, property-based, and mocked tests under a TDD workflow.

CCM score
71 of 100
skills.sh installs
14.8K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the RED-GREEN-REFACTOR cycle with worked examples for #[test], #[cfg(test)] modules, and assertion macros
  • Includes patterns for Result and panic testing, tests/ integration layouts, and #[tokio::test] async tests
  • Demonstrates rstest parameterized cases and fixtures, proptest properties with custom strategies, and mockall trait mocks
  • Designed for Rust projects that want coverage checked with cargo-llvm-cov against an 80%+ target

Install

$ npx -y skills add affaan-m/ecc --skill rust-testing -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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

  1. Identify target code — Find the function, trait, or module to test
  2. Write a test — Use #[test] in a #[cfg(test)] module, rstest for parameterized tests, or proptest for property-based tests
  3. Mock dependencies — Use mockall to isolate the unit under test
  4. Run tests (RED) — Verify the test fails with the expected error
  5. Implement (GREEN) — Write minimal code to pass
  6. Refactor — Improve while keeping tests green
  7. 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

Details

Repository
github.com/affaan-m/ecc
Categories
Rust, Testing & QA
First seen
Jul 14, 2026

Questions

What does the rust-testing skill help an agent do?

The rust-testing skill gives an agent Rust testing patterns for unit tests, integration tests, async tests, property-based testing, mocking, and coverage. It follows a TDD workflow with red, green, and refactor steps.

How do I install the rust-testing skill?

Run npx -y skills add affaan-m/ecc --skill rust-testing -y in your project to install it. Once installed, the agent can write Rust tests with proptest, mockall, and cargo-llvm-cov for coverage targets of 80% or more.

Where does rust-testing rank among Rust agent skills?

On the Rust category page on Claude Marketplaces, rust-testing ranks in the top 10. It sits alongside skills such as fix-errors, rust-best-practices, rust-async-patterns, rust-patterns, and memory-safety-patterns.

Does rust-testing cover async Rust code and mocking?

Yes, the skill includes async tests with Tokio using the tokio test attribute and timeouts. It also covers trait-based mocking with mockall, so units can be tested in isolation.

Who is rust-testing for?

It is for developers writing Rust functions, methods, or traits who want test coverage and a TDD workflow. It suits projects that need unit, integration, async, or property-based tests in Rust.

More from affaan-m/ecc

All 257

Similar to Rust Testing

More Rust