← All notes

Cargo test options and filtering

Answer: Multiple tests run in parallel on threads by default. cargo test compiles and executes unit, integration, and documentation tests.

Controlling tests

After cargo test options, use -- so further options reach the test binary. Name filters report how many tests were filtered out.

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). The Cargo Book (rust-lang/cargo): its MIT licence file names no copyright holder; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Rust Project (The Rust Programming Language book), Controlling How Tests Are Run, MIT OR Apache-2.0; The Cargo Book, cargo test, MIT OR Apache-2.0. Notices: The Rust Programming Language book (rust-lang/book): Copyright (c) 2010 The Rust Project Developers; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/book/blob/main/LICENSE-MIT). The Cargo Book (rust-lang/cargo): its MIT licence file names no copyright holder; MIT OR Apache-2.0, used under MIT (https://github.com/rust-lang/cargo/blob/master/LICENSE-MIT).

Cite this

Permanent ID: iil:note:fahsnatv

iinventedlight. 2026. "Cargo test options and filtering." iinventedlight Library, iil:note:fahsnatv, version of 2026-11-09. https://iinventedlight.com/library/notes/rust-cargo-test-options/. License: CC-BY-4.0.

@misc{iil_note_fahsnatv,
  author = {{iinventedlight}},
  title = {{Cargo test options and filtering}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-09},
  url = {https://iinventedlight.com/library/notes/rust-cargo-test-options/},
  note = {Permanent ID iil:note:fahsnatv. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/rust-cargo-test-options.md.