How do you decide what to test and how much?
Answer
- Test behavior and contracts, not internal details.
- Prioritize by risk: business-critical logic, money, security, complex branching, places that had bugs before.
- Pyramid: many unit tests for pure logic, integration tests at boundaries (database, APIs), a few end-to-end tests for critical user journeys.
- Edge cases: empty, null, limits, duplicates, concurrency, failing dependencies.
- Keep tests fast and deterministic so people actually run them.
- Use coverage to find gaps, not as a goal in itself.
Practice this question in Repaso