Use when adding or restructuring Rust tests, fixtures, mocks, snapshots, or test utilities in cli/. Not for choosing CI jobs or the general validation command sequence.
Scanned 8/31/2026
Install to Claude Code
npx -y skills add sneivandt/dotfiles --skill testing-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Testing Patterns?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/sneivandt-testing-patterns)More formats (shields.io, HTML) on the badges page.
---
name: testing-patterns
description: >
Use when adding or restructuring Rust tests, fixtures, mocks, snapshots, or
test utilities in cli/. Not for choosing CI jobs or the general validation
command sequence.
---
# Testing Patterns
## Place tests
- Keep small cohesive tests in inline `#[cfg(test)] mod tests`.
- Move large sibling suites to `tests.rs`.
- For a domain-root task file, use `domains/<domain>/tests/<feature>.rs` with a
test-only `#[path]`; never use `#[path]` for production wiring.
- Do not create a feature directory solely to hold tests.
## Reuse the harness
- Unit context/config helpers: `cli/src/app/test_helpers/`
- Integration helpers: `cli/tests/common/mod.rs`
- Executor results: `ExecResult::success` / `ExecResult::failure`
- Ordered fixed command scripts: `ScriptedExecutor`
- Branching or unordered execution: `MockExecutor`
- Common task assertions: `assert_task_ok`, `assert_task_changed`,
`task_batch`, `task_skipped`
- APM setup: `domains/ai/apm/test_fixture.rs`
- Environment behavior: inject `MapEnv`; never mutate process-global env
Prefer named case tables for repeated input/output cases. Assertions should
state behavior and include enough context to diagnose failure.
## Snapshots
Update snapshots intentionally, review them, and commit them with the behavior
change. Do not accept broad rewrites without inspecting the diff.
## Scope validation
Test target selection and commands live in
[Testing](../../../docs/TESTING.md). CI topology belongs in `ci-cd-patterns`.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!