Overview
Software testing is performed at different levels of granularity.
1. Unit Testing
- Scope: Individual methods, classes, or packages.
- Goal: Verify logic of smallest testable parts in isolation.
- Characteristics: Fast, easy to write, deterministic, high volume.
- Method: Inputs are passed to functions and outputs checked against expectations.
2. Integration Testing
- Scope: Interaction between modules or components.
- Goal: Verify that different parts work together correctly (e.g., Domain + Database).
- Characteristics: Slower than unit tests, harder to setup.
- Focus: Interfaces and data flow.
3. System Testing
- Scope: The entire integrated system.
- Goal: Verify the system meets requirements from a user’s perspective.
- Characteristics: Slowest, black-box, “real” environment.
- Focus: End-to-end scenarios, functional and non-functional requirements.
4. Manual Testing
- Scope: Exploratory.
- Goal: Validation (finding bugs automated tests miss, UI/UX issues).
- Characteristics: Non-automated, expensive, human-driven.
Comparison
| Feature | Unit Tests | Integration Tests | System Tests |
|---|---|---|---|
| Speed | Very Fast | Medium | Slow |
| Control | High (Easy to isolate) | Medium | Low |
| Realism | Low (Fake dependencies) | Medium | High |
| Fragility | Low | Medium | High (Flaky) |
| Volume | Many | Moderate | Few |