Interview kitsBlog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2026 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Testing
Testingmedium

What is contract testing and when is it useful?

Tags
#contract-testing#api#microservices
Back to categoryPractice quiz

Answer

Contract testing verifies that services agree on request/response schemas and behaviors without full end-to-end tests. It’s useful in microservices and external integrations.

Advanced answer

Deep dive

Contracts reduce integration surprises:

  • Consumer defines expectations; provider verifies them.
  • Detects breaking changes early.
  • Faster than E2E, more realistic than mocks.

Examples

Consumer-driven contract flow:

Consumer publishes contract -> provider validates in CI

Common pitfalls

  • Treating contracts as static and never updating them.
  • Missing non-functional expectations (timeouts, retries).
  • Overfitting to mocked data only.

Interview follow-ups

  • How do you version and evolve contracts?
  • How do you handle optional fields and backward compatibility?
  • What is the difference between contract tests and schema validation?

Related questions

Security
How do you protect a public API from abuse?
#rate-limiting#abuse#api
Next.js
Route Handlers in the App Router: how do you define them and what are they used for?
#nextjs#route-handlers#api
Microservices
Trace context propagation: what is the `traceparent` header and why should services forward it?
#microservices
#observability
#tracing
Microservices
Kafka ordering: what ordering guarantees do you get and how do you design for ordering?
#microservices#kafka#ordering
Microservices
Why is synchronous fan-out (one request calling many services) risky, and how do you reduce it?
#microservices#fan-out#latency
Microservices
REST vs gRPC for service-to-service calls: what are the key trade-offs?
#microservices#grpc#rest