Software Testing & QA Interview Questions and Answers
Test design, unit/integration/E2E, mocking, TDD and quality strategy.
Whether you are preparing for entry-level Software Testing & QA interview questions for freshers or senior software engineer interview questions addressing concurrency, scalability, and system architecture, this track provides peer-reviewed model answers with syntax walkthroughs, edge cases, and practical interview tips.
1 How do you add tests to legacy code that has none? Hard
Legacy code is often defined as code without tests, which makes changing it risky. The core technique is to introduce a seam, a place where behaviour can be substituted without editing the code under test.
Michael Feathers' approach:
- Identify a change point and find the smallest behaviour to pin down.
- Break dependencies by extracting interfaces, wrapping static or global calls, and injecting collaborators through constructors or parameters.
- Write characterisation tests that capture current behaviour, even if it looks wrong, so you know when you change it.
- Refactor under that safety net in small steps, then add tests for the new behaviour.
class Report {
Report(Clock clock, Mailer mailer) { ... } // seams injected
}
Tools help: approval or golden-master tests capture output for comparison, and dependency-breaking tools can substitute calls at link time. The risk is over-mocking, so prefer real fakes where feasible. Do not aim for full coverage first; cover the areas you are about to change.
2 How would you design a test strategy for a microservices system? Hard
Testing a distributed system needs a layered strategy, because full end-to-end coverage does not scale.
- Unit tests per service for domain logic, run on every commit.
- Component tests that start one service with its dependencies faked, to test its API and data layer.
- Contract tests, using consumer-driven contracts such as Pact, to verify that a provider still satisfies what consumers expect. This catches integration breaks without a full environment.
- Integration tests against real infrastructure for databases, queues and external gateways, ideally with testcontainers.
- A small number of end-to-end journeys, run against staging, for critical flows.
- Non-functional tests: load, resilience and chaos, to check behaviour under failure.
unit -> component -> contract -> integration -> e2e
Support this with test data management, environment parity, observability in CI and fast feedback. Prefer testing at the lowest layer that can catch a given bug, and make failures easy to localise, because debugging a red pipeline across ten services is the real cost.
Frequently Asked Questions About Software Testing & QA Interviews
What do hiring managers evaluate in Software Testing & QA technical rounds?
Technical interviewers look for foundational fluency, idiomatic syntax, clarity when communicating complex logic, and awareness of performance trade-offs (e.g. memory footprint, render performance, and network latency) in production environments.
What are the best interview tips for practicing Software Testing & QA questions?
Use active recall: summarize each answer in your own words before revealing the model solution. Focus on explaining why a certain approach is chosen rather than just memorizing code syntax.