Skip to content
masterclass Buddy

Rust · Command

cargo test

cargo test builds and runs Rust unit, integration, and documentation tests. You can filter test names and pass test-harness options after --.

Last updated

Syntax

cargo test [options] [testname] [-- test-options]

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • cargo test -- --help
  • cargo build --tests
  • cargo-bench
  • unit tests
  • integration tests
  • documentation tests

Source: cargo test - The Cargo Book. Checked 2026-11-03.