Mid-LevelAPI & Integration Testing
Explain the difference between REST and GraphQL. How does testing differ?
- REST
- GraphQL
- API architecture
Answer it first, then compare. Nothing here is saved or scored.
Model answer
REST: fixed endpoints per resource, HTTP verbs for CRUD, multiple round trips for related data. GraphQL: single endpoint, client specifies exactly what data it needs, fewer round trips. Testing differences: REST, test each endpoint/method combo. GraphQL - test queries, mutations, and subscriptions; validate query depth limits, authorization per field, and N+1 query performance. Both need schema validation, auth testing, and error handling tests.
What interviewers listen for
- Schema-first thinkingYou validate response shape before you assert on values, every time.
- Status-code literacyYou can defend why 401 vs 403 vs 422 matters for the consumer.
- Contract awarenessYou know when consumer-driven contract tests beat end-to-end checks.
- Auth fluencyYou can describe rotating tokens across parallel workers without secrets in logs.