1 Introduction
This chapter covers
- What this book is about and why it’s important
- A high-level overview of what contract testing is
- Why you should care about contract testing
- When contract testing is appropriate to use and not use
- How contract testing works
Imagine this scenario. It’s 4 p.m. on a Friday, and you decided to deploy a small change of updating one of your API’s data responses. All the automated tests from your pipeline are returning green, which gives you the confidence that you haven’t broken anything. You hit deploy, and a few minutes after the deployment, you get a message from another team that something is broken in production. It couldn’t be the change you recently deployed, because it was a small change, and all the tests are passing... right? As it turns out, this other team using your API has certain expectations. During the incident, you’ve learned that this other team has different expectations from yours. Rather than enjoying your Friday afternoon, you’re left with a production bug you must deal with.