Contract testing is an approach where each service call independently verifies the response. If any service is dependent then dependencies are stubbed. This way, the service functions without interacting with any other service. This is an integration test that allows us to check the contract of external services. Here we come to a concept called the consumer-driven contract (we will discuss this in detail in the following section).
For example, CustomerService allows new customers to register with the FlixOne Store. We do not store new customers' data in our database. We verify customer data before this to check for blacklisting or fraud user listing and so on. This process calls an external service that is maintained by another team or entirely by a third-party. Out tests will still pass if someone changes the contract of this external service because this change would not affect our test, as we stubbed the contract of this external service.