0
0
Rest APIprogramming~5 mins

Contract testing in Rest API - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is contract testing in REST APIs?
Contract testing is a way to check that two parts of a system, like a client and a server, agree on how they communicate. It makes sure the API responses and requests match what both expect.
Click to reveal answer
beginner
Why is contract testing important for REST APIs?
It helps catch problems early by verifying that changes in the API or client do not break their communication. This keeps apps working smoothly without surprises.
Click to reveal answer
intermediate
What are the two main types of contract testing?
The two main types are consumer-driven and provider-driven. Consumer-driven means the client defines what it needs. Provider-driven means the server defines what it offers.
Click to reveal answer
intermediate
How does a contract test differ from an end-to-end test?
Contract tests focus only on the agreement between client and server, checking request and response formats. End-to-end tests check the whole system working together, including UI and databases.
Click to reveal answer
beginner
Name a popular tool used for contract testing REST APIs.
One popular tool is Pact. It helps create and verify contracts between API clients and servers easily.
Click to reveal answer
What does contract testing primarily verify in REST APIs?
AThe database schema
BThe agreement on request and response formats between client and server
CThe user interface design
DThe speed of the API response
Which type of contract testing is driven by the client’s needs?
AProvider-driven
BEnd-to-end
CConsumer-driven
DUnit testing
Which tool is commonly used for contract testing REST APIs?
APact
BSelenium
CJest
DPostman
Contract testing helps prevent which of the following?
ABreaking changes between client and server
BSlow internet connection
CUI layout issues
DDatabase indexing problems
How is contract testing different from end-to-end testing?
AThey are the same
BContract testing tests UI; end-to-end tests API
CContract testing is slower than end-to-end testing
DContract testing checks communication agreements; end-to-end tests the full system
Explain what contract testing is and why it is useful in REST API development.
Think about how two friends agree on how to talk to each other.
You got /3 concepts.
    Describe the difference between consumer-driven and provider-driven contract testing.
    Who decides the rules: the client or the server?
    You got /3 concepts.