O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What is consumer-driven contract testing?

Contract testing means that we check our API against a set of expectations (what we define as contracts) which are meant to be fulfilled. This means that we want to check whether, upon receiving any API request call, our API server will return the data we specified in the documentation or not. We often miss out precise information regarding the needs of our API customers. To overcome this problem, consumers can define their set of expectations as mocks, which they use in unit tests, thus creating contracts that they expect us to fulfill. We collect these mocks and check that our provider returns the same or any similar data or not when they get called the same way as mocks are set up, thereby testing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required