cargo test [TESTNAME] [args...]

Execute all unit and integration tests and build examples of a local package




--bin <bin...>
  • Repeatable ♾
--example <example...>
  • Repeatable ♾
--test <test...>
  • Repeatable ♾
--bench <bench...>
  • Repeatable ♾
-p, --package <package...>
  • Repeatable ♾
--exclude <exclude>
  • Repeatable ♾
-j, --jobs <jobs>Number of parallel jobs, defaults to # of CPUs
--profile <profile>Build artifacts with the specified profile
--features <features...>
  • Repeatable ♾
--target <target>
  • Repeatable ♾
--target-dir <target-dir>Directory for all generated artifacts
--manifest-path <manifest-path>Path to Cargo.toml
--message-format <message-format>
  • Repeatable ♾
--color <color>Coloring: auto, always, never
--config <config>
  • Repeatable ♾
-Z <unstable-features>
  • Repeatable ♾
-q, --quietDisplay one character per test instead of one line
--libTest only this package's library unit tests
--binsTest all binaries
--examplesTest all examples
--testsTest all tests
--benchesTest all benches
--all-targetsTest all targets
--docTest only this library's documentation
--no-runCompile, but don't run tests
--no-fail-fastRun all tests regardless of failure
--workspaceTest all packages in the workspace
--allAlias for --workspace (deprecated)
-r, --releaseBuild artifacts in release mode, with optimizations
--all-featuresActivate all available features
--no-default-featuresDo not activate the `default` feature
--ignore-rust-versionIgnore `rust-version` specification in packages
--unit-graphOutput build graph in JSON (unstable)
--future-incompat-reportOutputs a future incompatibility report at the end of the build
-h, --helpPrint help information
-v, --verbose
  • Repeatable ♾
--frozenRequire Cargo.lock and cache are up to date
--lockedRequire Cargo.lock is up to date
--offlineRun without accessing the network
--timingsTiming output formats (unstable)