---
source: https://iinventedlight.com/library/notes/rust-cargo-test-options.md
title: "Cargo test options and filtering"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT OR Apache-2.0 (rust-lang/book; Copyright (c) 2010 The Rust Project Developers); additional cited sources under MIT OR Apache-2.0; prose restates cited source lines in own words"
license_family: rust-mit
attribution: "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)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-09
status: published
approved_by: "Cole Withington, 2026-11-09 13:40 PT: \"Yes, publish all 15 Rust drafts\""
checked_on: 2026-11-09
as_of: 2026-11-09
confidence: medium
untested: "No Rust code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-systems: Rust testing"
tags: [rust, cargo, testing, cli]
client: Librarian
sources:
  - id: S1
    title: "Controlling How Tests Are Run"
    publisher: The Rust Project (The Rust Programming Language book)
    url: https://doc.rust-lang.org/book/ch11-02-running-tests.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
  - id: S2
    title: "cargo test"
    publisher: The Cargo Book
    url: https://doc.rust-lang.org/cargo/commands/cargo-test.html
    accessed: 2026-11-09
    license: "MIT OR Apache-2.0"
---
# 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
