0
0
Microservicessystem_design~5 mins

Contract testing (Pact) in Microservices - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is contract testing in microservices?
Contract testing ensures that two services (like a client and a server) agree on how they communicate. It checks the 'contract' or agreement between them to avoid integration errors.
Click to reveal answer
beginner
What role does Pact play in contract testing?
Pact is a tool that helps create and verify contracts between services. It lets the client define expectations and the server verify them, ensuring both sides match their communication.
Click to reveal answer
intermediate
How does Pact improve microservices integration?
Pact catches mismatches early by testing interactions before deployment. This reduces bugs caused by changes in one service breaking another, making integration safer and faster.
Click to reveal answer
intermediate
What are the main components of a Pact contract?
A Pact contract includes the expected requests from the client and the expected responses from the server. It describes the interaction details like HTTP method, path, headers, and body.
Click to reveal answer
intermediate
Why is contract testing preferred over end-to-end testing in microservices?
Contract testing is faster and more focused. It tests only the communication between two services, not the whole system, making it easier to find and fix issues early.
Click to reveal answer
What does a Pact contract primarily verify?
AThe database schema of a service
BThe communication agreement between client and server
CThe UI design of a web application
DThe deployment process of microservices
Who typically creates the Pact contract in contract testing?
AThe client service defining expected requests
BThe server service defining database schema
CThe operations team managing deployment
DThe UI designer creating mockups
What is a key benefit of using Pact in microservices?
AEarly detection of communication mismatches
BFaster UI rendering
CAutomated database backups
DImproved server hardware performance
Which of these is NOT part of a Pact contract?
AHeaders and body content
BExpected HTTP response details
CExpected HTTP request details
DUser interface layout
Why might contract testing be preferred over full end-to-end testing?
AIt tests the entire system including UI
BIt replaces unit testing
CIt is faster and isolates communication issues
DIt requires no test automation
Explain how Pact helps ensure reliable communication between microservices.
Think about how two friends agree on a plan before meeting.
You got /4 concepts.
    Describe the main differences between contract testing and end-to-end testing in microservices.
    Compare checking a single conversation versus watching a whole play.
    You got /4 concepts.