11 Implementing provider-driven contract testing
This chapter covers
- Introduction to provider-driven contract testing
- Implementing consumer test adapters
- Implementing provider test with API testing tools
As mentioned in section 1.4, consumer-driven contract testing is when the consumer creates the contract and shares it with the data providers, essentially driving the requirements. The consumer-driven approach aims to avoid over-engineering from the provider side by only providing the data the consumer needs. Throughout chapter 2, we provide the benefits of adopting consumer-driven contract testing and in chapter 6 we talk about provider tests which verify consumer contracts. However, we also mentioned that the consumer-driven contract testing approach only works with good team communication and buy-in. However, there could be scenarios where teams can’t adopt this approach.
For instance, imagine that the web consumer example we used in chapter 1 has decided to use a third-party data provider who provides random images of dogs, as visualized in figure 11.1.