Unit Tests¶
Validate the smallest parts of the codebase independently, without external dependencies.
Focus¶
- Business logic
- Utility functions
- Domain behaviour
- Individual transformations
Characteristics¶
- Fast — should run in milliseconds
- Isolated — no database, no network, no filesystem
- Repeatable — same result every time
- Focused — one behaviour per test
Guidance¶
- Mock external dependencies at boundaries
- Test behaviour, not implementation
- Keep tests small and named clearly
- Automate on every PR in CI
Data-Specific Examples¶
- Python helper functions
- dbt schema tests for transformations, data types, column existence
- Individual transformation logic