SDET interview questions and answers
10 SDET interview questions with concise model answers: 0 junior, 6 mid-level and 4 senior. Topics: architecture, contracts, data, environments, integration, legacy code. Answer aloud first, then reveal the model answer and compare.
10 of 10 questions shown
-
What is the difference between a stub, a mock and a fake?
Model answer. A stub returns canned answers. A mock records and verifies interactions such as calls and arguments. A fake is a working, simplified implementation, for example an in-memory repository. Over-mocking couples tests to implementation, so prefer fakes and real collaborators where they are cheap.
-
How do you test code that calls a third-party payment API?
Model answer. Unit-test your logic against a stub or fake at the HTTP boundary. Add contract checks against the provider's schema or sandbox, and a few real sandbox smoke tests. Cover failure modes explicitly: timeouts, 5xx responses, duplicate webhooks and idempotency keys.
Tools: Postman, REST Assured
-
What problem does consumer-driven contract testing solve?
Model answer. It catches breaking API changes between services without spinning up the whole system. The consumer states what it needs, the provider verifies those expectations in its own CI, and an incompatible change fails before deployment. It complements functional tests; it does not replace them.
-
A test passes alone but fails when run with others. What are the usual causes?
Model answer. Shared mutable state such as static fields, database rows, files or ports; order dependence; time or random-seed dependence; and resource limits. Detect it by randomising order and running in parallel, then fix by isolating state per test with fixtures.
-
How do you make integration tests reproducible?
Model answer. Start dependencies in disposable containers (Testcontainers or Compose) with pinned image versions, wait on health checks rather than sleeps, seed known data, and avoid calls to external networks. The same command should work on a laptop and in CI.
Tools: Docker
-
How do you add a performance smoke test to a pull request pipeline without making it noisy?
Model answer. Run a short k6 script at low load against a stable environment on a dedicated runner and assert on p95 latency and error rate with a tolerance around a stored baseline. Keep heavy load and soak tests nightly. Trend results so slow drift is visible even when each run passes.
Tools: k6
-
You must build a test framework used by six teams. What are your key decisions?
Model answer. A thin, versioned core library for configuration, auth, API clients, data builders and reporting, with teams owning their tests and extending through documented hooks. Ship CI templates, keep defaults opinionated, avoid a custom DSL, and measure adoption and maintenance cost so the framework serves teams instead of constraining them.
-
How do you introduce testability into a legacy service with no seams?
Model answer. Write characterization tests at the outermost boundary to pin current behaviour, then introduce seams (dependency injection, interfaces for clock and I/O) in small steps and refactor under that safety net. Use feature flags for risky changes and add observability hooks so behaviour can be inspected in tests.
-
How do you test a database migration safely?
Model answer. Run it on a production-shaped copy with anonymised data and realistic volume, and check duration, locks, row counts and checksums before and after. Design it as expand and contract so old and new application versions can run against the schema at the same time, and rehearse the rollback.
-
Coverage is 90% yet defects still ship. What do you measure instead or in addition?
Model answer. Coverage shows code was executed, not verified. Add mutation testing (PIT, Stryker) to see whether tests fail when behaviour changes, review assertion quality on critical modules, and track escaped defects and flake rate. Use coverage only to find untested areas, not as a target.
No question matches those filters. Clear the search or choose All.
Practise like an interview
- Say your answer out loud before revealing the model answer.
- Add a real example from your work. Interviewers remember stories, not definitions.
- Mark what you can answer cleanly and repeat the rest tomorrow.
- Notice the trade-offs in each answer; senior questions are scored on judgement.
Know the stack
Skills interviewers look for: Strong programming (Java / C# / Python / TS), Design patterns, CI/CD and containers, Distributed systems basics, Code review.
Interview questions for other roles
Manual QA Tester
Exploratory, regression and acceptance testing on web and mobile products.
QA Automation Engineer
Builds and maintains UI and API test suites that run in CI on every commit.
AI / LLM Evaluation QA
Evaluates model outputs, writes rubrics and builds regression sets for AI features.
Accessibility Tester
Audits products against WCAG 2.2 with assistive technology and automation.
Business / Test Analyst
Turns requirements into test conditions and runs user acceptance with the business.
Data / ETL QA Engineer
Validates pipelines, warehouses and reports so the numbers can be trusted.