rust-testing

Installation
SKILL.md

Rust testing

Use this skill when designing tests, changing test code, or diagnosing a failing Rust test suite.

Inspect the test setup first

Check workspace and package manifests, test modules, integration tests under tests/, doctests, feature flags, cfg attributes, CI commands, and existing helpers. Follow the project's test dependencies and naming style. Don't add a testing crate just to use a familiar pattern.

Choose the right test boundary

  • Put small unit tests beside private implementation details when they need access to those details.
  • Use integration tests for observable public behavior, binary behavior, and interactions across crate boundaries. They compile as external users would and help protect API usability.
  • Use doctests for public examples and contracts callers need to understand. Keep examples deterministic and self-contained.
  • Test the behavior and boundary conditions that matter: empty and malformed input, error variants/context, state transitions, limits, and regressions. Avoid assertions about private implementation details unless those details are the behavior under test.
  • Prefer a few precise assertions about one behavior over tests coupled to incidental output or setup order. A test may assert several related properties when they jointly define the same contract.

Keep tests reliable

Installs
2
Repository
1arley/skills
First Seen
14 days ago