2 / 2 · Book 4 · The API Testing Landscape · drill: interview Q&A← prev⊞ allGet the book →
1.12Interview Depth Check
Question 1
Prompt: Your team manages 12 microservices. A field rename in one service caused a silent data corruption that was not caught for two weeks. How would you prevent this? What a strong answer should cover:
- Consumer-driven contract testing (Pact) to detect breaking changes before deployment
- Schema drift detection to compare documentation against actual behavior
- The "can I deploy?" check in CI/CD pipelines Example answer:
- "I would introduce Pact contracts between every consumer-provider pair. The consumer publishes what it expects, the provider verifies it can deliver, and both check 'can I deploy?' before releasing. A field rename would fail the provider verification immediately because the consumer still expects the old field name. Additionally, I would run daily schema drift detection to catch any doc-vs-implementation divergence."
Question 2
Prompt: Explain the difference between schema-driven testing and contract testing. When would you use each? What a strong answer should cover:
- Schema-driven testing validates a single API against its own specification
- Contract testing validates the integration between two services
- They serve different layers of the testing pyramid Example answer:
- "Schema-driven testing verifies that an API's implementation matches its OpenAPI spec -- correct status codes, field types, boundary enforcement. Contract testing verifies that two services agree on what they exchange. I use schema-driven tests on every PR to catch regression in individual services, and contract tests to catch integration breaks between services. They complement each other: schema tests catch 'the API is broken' and contract tests catch 'the API changed in a way that breaks a consumer.'"
Question 3
Prompt: You are asked to evaluate whether AI-generated tests are good enough to replace manually written tests. What is your assessment? What a strong answer should cover:
- AI excels at exhaustive constraint coverage and boundary generation
- AI misses business logic, domain-specific edge cases, and test infrastructure setup
- The right model is AI generation + human curation Example answer:
- "AI-generated tests are a strong starting point, not a replacement. AI systematically covers every schema constraint -- boundaries, type mismatches, enum values, auth scenarios -- which humans often skip. But AI misses domain-specific logic, undefined helper functions, and test environment nuances. I use AI to generate the first pass, then curate: extract shared fixtures, replace hardcoded URLs, add error message assertions, and supplement with business logic tests that require domain knowledge."