6 Implementing consumer-driven provider contract tests
This chapter covers
- Contract testing tooling setup for the provider
- Provider contract tests between a web application and a data provider
- Provider contract tests between a mobile application and a data provider
In chapters 4 and 5 of this book, our primary focus was on creating the contract tests designed for various consumers. It's essential to keep in mind that in contract testing, there are two sets of tests that you need to write, one set encompassing consumers, the other encompassing providers. Based on our practical experience, we found that when it comes to setting up provider contract tests, this phase typically demands less code than its counterpart, the consumer contract tests.
Within the scope of consumer-driven contract testing, we observed that most of the contract testing efforts belong to the consumer teams. After all, it's the consumer teams that essentially lay down the terms of the contract that providers must adhere to. Nevertheless, this should not devalue the significance of provider tests. In fact, provider tests hold equal weight in contract testing. Without properly executed provider tests, the contract testing lifecycle cannot function as intended.