tldr/pages/common/cargo-test.md

29 lines
643 B
Markdown
Raw Normal View History

2020-09-08 17:19:03 +01:00
# cargo test
2020-08-30 05:00:03 +01:00
> Execute the unit and integration tests of a Rust package.
> More information: <https://doc.rust-lang.org/cargo/commands/cargo-test.html>.
- Only run tests containing a specific string in their names:
`cargo test {{testname}}`
- Set the number of simultaneous running test cases:
2023-10-29 08:54:53 +00:00
`cargo test -- --test-threads {{count}}`
2020-08-30 05:00:03 +01:00
- Test artifacts in release mode, with optimizations:
`cargo test --release`
- Test all packages in the workspace:
`cargo test --workspace`
2023-10-29 08:54:53 +00:00
- Run tests for a specific package:
2020-08-30 05:00:03 +01:00
`cargo test --package {{package}}`
- Run tests without hiding output from test executions:
`cargo test -- --nocapture`