Unit tests validate individual components in isolation, ensuring correct behavior without external dependencies.
- Naming Conventions -
it_should_pattern with examples - AAA Pattern - Arrange-Act-Assert structure
- Parameterized Tests - Using rstest for multiple test cases
- Mock Clock - Deterministic time testing with MockClock
- Temp Directories - TempDir usage and cleanup
- Test Builders - Builder pattern for test setup
- Isolation: Tests should not depend on external state or other tests
- Determinism: Same input always produces same output
- Fast Execution: Unit tests should run quickly
- Clear Intent: Test names and structure should be self-documenting