CARGO-TEST(1) General Commands Manual CARGO-TEST(1) (NAME) cargo-test - Rust (SYNOPSIS) cargo test [] [_] [-- _] (DESCRIPTION) (Unit) (Integration) (Doc tests). TESTNAME (--) libtest ( rustc ) . Cargo -- Cargo . libtest cargo test -- --help rustc . foo (Thread) : cargo test foo -- --test-threads 3 --test rustc libtest . #[test] . #[bench] . . libtest harness = false main . (Documentation tests) rustdoc . . rustc doctest . . libtest --jobs . doctest . rustdoc . (Working directory of tests) . cargo test . rustdoc (Workspace) rustdoc . --test-run-directory rustdoc . (OPTIONS) (Test Options) --no-run . --no-fail-fast . Cargo . Rust . (Package Selection) ( --manifest-path ). . workspace.default-members . ( --workspace) (Crate) . -p spec, --package spec . SPEC cargo-pkgid(1) . glob * ? [] . glob Cargo . --workspace . --all --workspace. --exclude SPEC . --workspace . glob * ? [] . glob Cargo . (Target Selection) cargo test : o lib -- o bins ( ) o examples -- o lib o bins o (integration tests) o lib test . test = true main libtest . main harness = false . test = false . ( --example foo) test . doctest = false . . . . CARGO_BIN_EXE_ ( ) env var . . --bin --example --test --bench glob * ? [] . glob Cargo glob . --lib . --bin name . glob . --bins . --example name . glob . --examples . --test name . glob . --tests test = true . . lib ( ). test . --bench name . glob . --benches bench = true . bench . lib ( ). bench . --all-targets . --lib --bins --tests --benches --examples . --doc . . (Feature Selection) . default . . -F features, --features features . package-name/feature-name . . --all-features . --no-default-features default . (Compilation Options) --target triple . . . (Triple) --- . : o rustc --print target-list. o "host-tuple" . (Cross-compile) ( xtask ). o . Masir Jostojuye Hadafe Sefareshi . build.target . Cargo . (build cache) . -r, --release release. --profile . --profile name . . --timings . cargo-timing.html target/cargo-timings . . . (Output Options) --target-dir directory . CARGO_TARGET_DIR build.target-dir . target . (Display Options) Rust . --no-capture ( ): cargo test -- --no-capture -v, --verbose . << >> . term.verbose . -q, --quiet cargo. term.quiet . --color when . : o auto (): . o always: . o never: . term.color . --message-format fmt . . : o human (): . short json . o short: . human json . o json: JSON (stdout). . human short . o json-diagnostic-short: rendered JSON <<>> rustc . human short . o json-diagnostic-rendered-ansi: rendered JSON ANSI rustc . human short . o json-render-diagnostics: Cargo rustc JSON Cargo JSON rustc . JSON Cargo rustc . human short . (Manifest Options) --manifest-path path Cargo.toml. Cargo Cargo.toml . --ignore-rust-version rust-version . --locked Cargo.lock . Cargo : o lock . o Cargo lock . CI . --offline Cargo . Cargo . Cargo . . Cargo . cargo-fetch(1) . net.offline . --frozen --locked --offline . (Common Options) +toolchain Cargo rustup cargo + rustup ( +stable +nightly) . rustup . --config KEY=VALUE PATH Cargo. TOML KEY=VALUE . . . -C PATH . cargo (Cargo.toml) .cargo/config.toml . cargo -C path/to/my-project build. nightly -Z unstable-options ( #10098 ). -h, --help . -Z flag ( nightly) Cargo. cargo -Z help . (Miscellaneous Options) --jobs . Rust : cargo test -j 2 -- --test-threads=2 -j N, --jobs N . build.jobs . . . default . 0 . --future-incompat-report (future-incompat report) . cargo-report(1) . cargo test --keep-going . --no-fail-fast . <<>> --tests . : cargo build --tests --keep-going cargo test --tests --no-fail-fast (ENVIRONMENT) Cargo . (EXIT STATUS) o 0: . o 101: . (EXAMPLES) 1. : cargo test 2. : cargo test name_filter 3. : cargo test --test int_test_name -- modname::test_name (SEE ALSO) cargo(1), cargo-bench(1), types of tests , how to write tests CARGO-TEST(1)