rust-testing
Rust testing patterns including unit tests, integration tests, async testing, property-based testing, mocking, and coverage. Follows TDD methodology.
npx skills add mturac/everything-openai-codex --skill rust-testing --agent codex
Same command for any agent — swap --agent for claude-code, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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 ```rust // RED: Write test fi
- When to Use
- How It Works
- TDD Workflow for Rust
- The RED-GREEN-REFACTOR Cycle
- Step-by-Step TDD in Rust
- Unit Tests
- Module-Level Test Organization
- Assertion Macros
- Error and Panic Testing
- Testing Result Returns
- Testing Panics
- Integration Tests
- File Structure
- Writing Integration Tests
cargo llvm-cov # Summary cargo llvm-cov --html # HTML report cargo llvm-cov --lcov > lcov.info # LCOV format for CI cargo llvm-cov --fail-under-lines 80 # Fail if below threshold cargo test # Run all tests cargo test -- --nocapture # Show println output cargo test test_name # Run tests matching pattern cargo test --lib # Unit tests only cargo test --test api_test # Integration tests only cargo test --doc # Doc tests only
What does the rust-testing skill do?
Rust testing patterns including unit tests, integration tests, async testing, property-based testing, mocking, and coverage. Follows TDD methodology.
How do I install it?
Run `npx skills add mturac/everything-openai-codex --skill rust-testing --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From mturac/everything-openai-codex, a repository with 84 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
