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.

11.1 Introduction to provider-driven contract testing

 

11.1.1 Why was provider-driven contract testing introduced?

 
 
 
 

11.1.2 How provider-driven addresses the drawbacks of consumer-driven contract testing

 
 
 

11.1.3 Drawbacks with provider-driven contract testing

 

11.2 Implementing consumer test adapters

 
 
 

11.2.1 Cypress consumer adapter

 
 

11.2.2 WireMock consumer adapter

 
 

11.2.3 Publish consumer contracts

 
 
 
 

11.3 Implementing provider test with API testing tools

 

11.3.1 Postman and OpenAPI example

 
 
 

11.3.2 Dredd and OpenAPI example

 
 

11.3.3 Publish provider API specification and test results

 
 
 

11.3.4 Checking consumer contracts

 
 
 

11.4 Summary

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest