Skip to Content
Contract Testing in Action
book

Contract Testing in Action

by Lewis Prescott, Marie Cruz
January 2025
Intermediate to advanced
304 pages
7h 56m
English
Manning Publications

Overview

Contract testing is a simple, reliable way to make sure that each service and API plays nice with other components so you can deploy independently and safely.

Large, loosely coupled systems have hundreds, even thousands, of interactions—and traditional testing can often struggle to keep up! Enter contract testing. This rapidly growing new approach checks API and service compatibility by verifying it against an agreed contract. No more unexpected integration issues, and no more breaking things in production!

In Contract Testing in Action you’ll learn:

  • The core concepts and practices of contract testing
  • Testing microservices with Pact
  • Consumer-driven and bi-directional testing
  • Building a contract testing framework
  • Converting API integration tests to contract tests

Contract Testing in Action introduces the practice of contract testing through engaging hands-on examples. You’ll learn how to introduce contract tests for multiple different types of communication, from REST APIs to event-driven architecture. By the end of this practical guide, you’ll be comfortable with advanced contract testing concepts like can-i-deploy, provider states, and webhooks. You’ll even get tips on how to introduce contract testing to your team and other business stakeholders.

About the Technology
It’s difficult to test API and event-based services that can be used by many applications simultaneously through a complex network of integrations. Contract testing offers a straightforward solution. API and service compatibility are verified against agreed-upon contracts that each component in the system—and the developers that build them—can understand and respect. This transformative technique helps uncover integration issues early and adds vital transparency to any system.

About the Book
Contract Testing in Action makes it easy for your team to adopt contract testing for microservices and other API-centric systems. You’ll start by learning how contract testing fits into the software development lifecycle, and then you’ll explore practical methods to integrate it with your own tech stack and practices. You’ll use leading contract testing tools—including Pact, PactFlow, and GitHub Actions—to build your own contract testing framework, set up consumer-driven contract testing for REST and GraphQL APIs, and integrate it into your CI/CD pipeline.

What's Inside
  • Testing microservices with Pact
  • Consumer-driven and bi-directional contract testing
  • Building a contract testing framework
  • Converting API integration tests to contract tests


About the Reader
For software developers and quality engineers who have worked with Java or JavaScript, and APIs.

About the Authors
Marie Cruz is a Software Tester with over ten years of experience and also a Developer Advocate at Grafana Labs. Lewis Prescott is a Test Specialist at IBM with over nine years experience in software testing.

Quotes
Shows you how to add contract testing to your testing efforts, and more importantly why you should consider it.
- Bas Dijkstra, On Test Automation

You’ll feel like the authors are working with you side-by and quickly reap the benefits of contract testing.
- Lisa Crispin, Lisa Crispin Consulting, LLC

Incredibly comprehensive and balanced overview. I thoroughly recommend it.
- Yousaf Nabi, SmartBear

Does an exceptional job of demystifying contract testing!
- Rafaela Azevedo, The Chaincademy

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Effective Software Testing

Effective Software Testing

Mauricio Aniche

Publisher Resources

ISBN: 9781633437241Publisher SupportPublisher Website