cargo-test

Installation
SKILL.md

Cargo Test

Rust treats testing as a first-class citizen. cargo test runs unit tests (in the same file), integration tests (in tests/), and uniquely, Documentation Tests (code blocks in your doc comments).

When to Use

  • Rust Unit & Integration Testing: The official, built-in test runner for Rust crates, libraries, and binaries.
  • Doc-Tests Verification: Compiling and testing code examples written inside /// documentation comments automatically.
  • Benchmark & Micro-Optimizations: Measuring algorithmic performance and allocations using cargo bench and criterion.
  • Concurrency & Parallel Test Execution: Running hundreds of test threads safely with thread isolation by default.

Quick Start

// lib.rs
pub fn add(a: i32, b: i32) -> i32 {
    a + b
}
Installs
7
GitHub Stars
15
First Seen
Feb 10, 2026