24.2 Kinds of Tests
Rust categorizes tests into three main types:
- 
Unit Tests - Validate small, focused pieces of functionality within the same file or module.
- Can access private items, enabling thorough testing of internal helpers.
 
- 
Integration Tests - Stored in the tests/directory, with each file acting as a separate crate.
- Import your library as a dependency to test only the public API.
 
- Stored in the 
- 
Documentation Tests - Embedded in code examples within documentation comments (///or//!).
- Verify that the documentation’s code examples compile and run correctly.
 
- Embedded in code examples within documentation comments (
By default, running cargo test compiles and executes all three categories of tests.