6 Implementing consumer-driven provider contract tests
This chapter covers
- Guidelines in writing consumer-driven provider contract tests
- Contract testing tooling setup for the provider
- Provider contract tests between a web application and a data provider
- Provider contract tests between a mobile app 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 and 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 (CDCT), 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 shouldn’t devalue the significance of provider tests. In fact, provider tests hold equal weight in contract testing. Without properly executed provider tests, the contract testing life cycle can’t function as intended.