How do you decide what to unit test versus integration test, and how do you keep the suite fast and reliable?

role-specific · Mid level · software-engineering

What the interviewer is really asking

Probes practical testing judgment — choosing the right test level for the risk, and keeping a suite trustworthy and fast rather than slow and flaky, which is a mid-level ownership signal.

What to say

What to avoid

Example answers

Strong: Our checkout pricing had a dozen discount branches, so I unit-tested those exhaustively with no I/O. But the bug history was all in the Stripe and tax-service calls, so I added integration tests against a sandbox and testcontainers Postgres for exactly those seams. Coverage went where the risk was, not where it was easy.

Weak: I aim for 100% coverage — if every line is covered, the code is well tested.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.