Bird
0
0

Which of the following is the correct way to define a contract test for a REST API endpoint?

easy📝 Syntax Q12 of 15
Rest API - API Testing and Monitoring
Which of the following is the correct way to define a contract test for a REST API endpoint?
ATest the API's front-end layout on different browsers
BMeasure the time taken for the API to respond
CVerify the API server's CPU usage during requests
DCheck if the API returns the expected status code and response body
Step-by-Step Solution
Solution:
  1. Step 1: Identify contract test elements

    Contract tests verify the API response matches the agreed format, including status codes and body content.
  2. Step 2: Match options to contract test definition

    Check if the API returns the expected status code and response body matches this exactly; others relate to performance, server metrics, or UI, which are not contract tests.
  3. Final Answer:

    Check if the API returns the expected status code and response body -> Option D
  4. Quick Check:

    Contract test = expected response check [OK]
Quick Trick: Contract tests check expected status and response body [OK]
Common Mistakes:
MISTAKES
  • Confusing contract tests with performance or UI tests
  • Ignoring response body content in contract tests
  • Testing server hardware instead of API contract

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes