Backend Engineering
Testing
5 practice questions. Free questions open a full answer guide; the rest unlock with Pro.
- How do you decide what to unit test versus integration test, and how do you keep the suite fast and reliable?
- Your backend has logic that depends on time and asynchronous behavior — token expiry, scheduled jobs, retries with backoff, and a write that only becomes visible to a read after an event propagates. The tests for these are the flakiest in the suite. How do you make this kind of nondeterministic backend code reliably testable?Go Pro
- When you write a unit test for code that calls a database or an external API, why would you replace those with a test double, and what's the risk of overusing mocks?Go Pro
- How do you decide what to test with fast unit tests versus integration tests on a backend service, and how do you handle external dependencies like a database or a third-party API in those tests?Go Pro
- You're setting up the test harness for a backend service whose integration tests hit a real relational database. A teammate proposes wrapping each test in a transaction and rolling it back at the end for speed and isolation. As the senior engineer, how do you reason about test isolation here, and what's your concern with the rollback approach?Go Pro
Want questions matched to your role? Paste a job title, job description, or CV for a personalized set, or go Pro to unlock the full bank.