All jobs / Backend developer / Testing
Backend developer interview question · 5+ years
Three teams call your service. Twice this quarter one of your releases broke one of them, and nobody noticed until their alerts fired.
What would consumer-driven contract tests give you here?
The strongest answer
Each consumer publishes the requests it makes and the response fields it relies on, and your pipeline verifies every published contract before release — so CI tells you which consumer you would break, and which fields nobody uses
Why it works
Exactly — and the second half matters: contracts show which fields nobody relies on, which is how you get to delete things safely.
What a good answer covers
- Consumers publish what they rely on.
- Verify every contract before release.
- Break in CI, not in their alerts.
- Unused fields become safe to remove.
Answers that fall short
- Close, but not the strongest: Tests written by the consumers that run in our pipeline and fail the build when we break them
That is the mechanism; what makes it work is that the expectations come from the consumers’ own tests rather than your guess about them. - Weak: An integration environment where all four services are deployed together and an end-to-end suite runs against it
A full environment is slower and flakier, and it tells you about one deployed combination, not about each consumer’s expectations. - Red flag: A release note, and each team tests their own integration after we have deployed
Shipping first and letting others find the break is how you got here; the point is to know before the release.
Who gets asked this
More Testing questions
- The service’s CI suite fails about one run in five for reasons unrelated to the change, and the team’s habit…
- A teammate calls their test a unit test, but it starts a database container and an HTTP server. Does the…
- In a test, what is the difference between a stub, a mock and a fake?
- Your repository tests run against an in-memory database and pass, but the same query fails in production…
- How do you test that POST /orders returns 201 with the right body, without deploying anything?
- A refactor that changed no behaviour broke forty tests. Each one asserts that a particular method was called…