cargo-test

Cargo Test

Used in 209 rust projects (avg ★238)

Rust
Testing
Default
Used by 209 projects

Details

Language / Topic
rustRust
Category
Testing

Rules

balanced
- Run all tests with `cargo test`.
- Run specific tests with `cargo test -- test_name`.
- Place unit tests inline in source modules using `#[cfg(test)] mod tests { use super::*; #[test] fn test_name() { ... } }`.
- Place integration tests in the `tests/` directory.
- Unit tests next to code enable fast iteration and access to private items via `super::*`.
- Organize `tests/` into subdirectories like `integration/`, `models/`, `backend/` for categorization.
- Integration tests run as separate binaries, testing full workflows.
- Unit tests compile with the library for focused, efficient testing.