Rust
Test Commands
Run unit tests, integration tests, doc tests, and benchmarks with Cargo. Rust's built-in test framework requires no additional dependencies for comprehensive testing.
8 commands
Pro Tips
Run a specific test: 'cargo test test_name' filters by name. Use 'cargo test -- --nocapture' to see println! output.
Use 'cargo test --doc' to run documentation examples as tests — keeps your docs accurate.
Use '#[ignore]' attribute and 'cargo test -- --ignored' for slow integration tests you don't want in every run.
Common Mistakes
Tests run in parallel by default. Use '--test-threads=1' if tests share resources like databases or files.
Doc tests compile each example as a separate binary — they're slower than unit tests. Keep them focused.