Microservices are all the rage right now. Breaking up code into small independent services has many
benefits, but on the downside, it increases the number of integration points, which increases the amount of
integration testing required.
How can we be confident that all our services will work correctly together, without being burdened by
complex and brittle integration tests? Learn how Pact solves this problem by using consumer driven
contracts.
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Consumer-Driven Contracts with Pact (Sydney API Days 2015)
1. Pacts to the rescue!
Making your microservices play nicely together
with Consumer Driven Contracts
Beth Skurrie
@bethesque / @pact_up
bskurrie@dius.com.au
2. “Integrated tests are a scam.
A self replicating virus
that threatens
the very health of your codebase,
your sanity,
and I'm not exaggerating when I
say,
your life.”
- JB Rainsberger
3. Integrated Tests: The Problems
! Slow
! Easy to break
! Hard to fix
! Scales combinatorially
3 classes, 4 code paths each
4 * 4 * 4 = 64 tests
39. Pact allows you to:
! Combine the advantages of integrated tests and test symmetry
! Mitigates the shortcomings of each method
! Allows you to modify components with agility - quick feedback
on potential breakages
! Have confidence that all the services in your system will work
together
! Throw away your integration tests!!!
40. Pact
Makes your microservices play nicely together
with Consumer Driven Contracts
github.com/realestate-com-au/pact
@pact_up
Beth Skurrie
bskurrie@dius.com.au
@bethesque
• Regular expressions & type
based matching
• Why doesn’t Pact use JSON
Schema?
• How to avoid versioning APIs
• How to use Pact between teams
• Should I use Pact for testing
external APIs?
• How not to do it
• And moar!