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
- id: C1 claim: Tests run in parallel by default using threads. source: S1 evidence: "When you run multiple tests, by default they run in parallel using threads, meaning they"
- id: C2 claim: List cargo test args, then --, then test-binary args. source: S1 evidence: "followed by the separator -- and then the ones that go to the test binary."
- id: C3 claim: Filtering reports how many tests were filtered out. source: S1 evidence: "filtered out at the end. We can't specify the names of multiple tests in this"
- id: C4 claim: cargo test compiles and executes unit, integration, and documentation tests. source: S2 evidence: "Compile and execute unit, integration, and documentation tests."
Sources
- [S1] Controlling How Tests Are Run. The Rust Project (The Rust Programming Language book). https://doc.rust-lang.org/book/ch11-02-running-tests.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.
- [S2] cargo test. The Cargo Book. https://doc.rust-lang.org/cargo/commands/cargo-test.html . License: MIT OR Apache-2.0. Accessed 2026-11-09.
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
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.},
}
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.