# Rust Testing

> ---

- Skill: `huiali/rust-testing` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add huiali/rust-testing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/huiali/rust-testing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: huiali (https://skillmd.com/u/huiali)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/huiali/rust-testing

---

---
name: rust-testing
description: "Rust testing expert for unit, integration, async, property-based, concurrency, and benchmark testing workflows."---

# Rust Testing Skill

Use this skill for detailed, production-ready guidance in this Rust domain.

## Core Question

**How do we keep tests deterministic, fast, and meaningful?**

## Solution Patterns

- Use unit tests for logic, integration for contracts
- Use property tests for invariants
- Use loom/criterion for concurrency/perf confidence

## Workflow

1. Reproduce and isolate the issue with a minimal failing case.
2. Choose the smallest safe design that satisfies constraints.
3. Implement with explicit ownership, errors, and boundaries.
4. Verify with tests, linting, and scenario-specific checks.

## Review Checklist

- [ ] Correct behavior for both success and failure paths.
- [ ] Ownership and API boundaries are explicit.
- [ ] Error handling and diagnostics are actionable.
- [ ] Performance-sensitive paths are measured.
- [ ] Regression tests cover the changed behavior.

## Common Pitfalls

- Fixing flakes with sleep
- Over-mocking
- Slow tests in default CI path

## Verification Commands

```bash
cargo test
cargo test -- --nocapture
cargo bench
cargo nextest run
```

## Related Skills

- `rust-concurrency`
- `rust-performance`
- `rust-database`

