SlideShare a Scribd company logo
GET/
with the Pact
Gotchas of
implementing
Contract Testing
the “right” way
Bernardo Guerreiro
Senior Engineer @ Auth0
Platform Team
London, UK (Remote) 2
Twitter: @bernardobridge
Medium: https://medium.com/@bernardobridge
Workshop Requirements
Do I need to know about Pact
already?
Nope. But it can’t hurt!
Do I need a laptop?
No. But you can follow with one!
3
Do I need to know Javascript?
No. But it would help to understand
some of the nuances. All concepts
are transferable.
@bernardobridge
A Commit Story - The
Movie
https://github.com/bernardobridge/cinema-services-app/
4
@bernardobridge
5
@bernardobridge
Part 1
The Curious Case of the Missing Tests
Uhm...someone “forgot” to write tests
again
@bernardobridge
“
7
@bernardobridge
Part 2
Finding Testability
FFS! Testing is hard.
@bernardobridge
“
9
@bernardobridge
Key Takeaways
▹ You need testability before you need
Pact
▹ Work with developers to achieve that
▹ Mocking dependencies introduces a time
related risk - you never know what’s still
valid
▹ Integration Testing of Microservices can
get very complicated very fast
10
@bernardobridge
Part 3
The Dark Pact
Contract Testing: a hero without a cape
@bernardobridge
“
12
@bernardobridge
Key Takeaways
▹ Pact works very similarly to existing
mocking, but you are able to verify validity
of the contract over time
▹ Your contracts should be as narrow as
what your service actually consumes
▹ You can use Matchers to ensure your
contracts are well suited
▹ Provider state allows you to inject data
you may need to use to be able to replicate
calls when verifying the provider
▹ Having consistent naming conventions is
important to this workflow
13
@bernardobridge
Part 4
V for Version
My version is better than your version :P
@bernardobridge
“
15
@bernardobridge
Key Takeaways
▹ Pact pre-verifies versions for you when it
knows the contract hasn’t changed and it
had already been successfully verified
▹ Your provider version can’t just change
when you release, as that’s too late in the
release cycle
▹ You need your provider version to
dynamically change with new code
commits, so you can use commit sha’s
▹ Application Versions in the Pact world are
about what code is running
16
@bernardobridge
Part 5
The Instagram Principle
Click here to tag your location
@bernardobridge
“
18
@bernardobridge
Key Takeaways
▹ If versions are about what piece of code is
running, tags are about where it is running
▹ Branches are a natural candidate for
where the code is running
▹ You can use consumerVersionTags to
filter your provider verification results
▹ Think about the verification step triggered
by the consumer, and the verification step
from normal CI flow as different entities
▹ Make sure you are tagging the latest
master Pact with a prod tag after
releasing to prod. This lets you guarantee
backwards compatibility
19
@bernardobridge
Final Thoughts
(you must be tired by now)
@bernardobridge
Getting Started: a few tips
Run POC’s
Proofs of Concept
help establish
confidence in the
time/resource
investment by
demonstrating
usefulness with
minimal investment.
Involve Tech Leads
and Principals
These people have a
wide reach in the
organization, and can
help enforce/nail
down implementation,
proliferation and
technical decisions.
Involve SRE/DevOps
A lot of the hurdles
you will face will be
about retrofitting this
into a CI/CD pipeline.
Get help from the
experts in this area.
You’ll need it!
21
Become a Champion
Be the Champion for
adoption of this tool,
running workshops,
brown bags, POC’s
with teams, etc.
Create
RFC’s/equivalent
RFC (Request for
Comments) are a good
way to centralise
knowledge, clear
doubts, but also to
enforce conventions
everyone can adopt.
Get business buy-in
This is not easy, but if
business/product can
understand the value of
this, resource allocation
and help become much
easier to obtain. Pact
works best if everyone
uses it. It should be a
company goal.
@bernardobridge
Useful Links
PACT.io Docs:
https://docs.pact.io/
Workshop Github Repo:
https://github.com/bernardobridge/cinema-services-app
Pact Foundation Slack Channel:
https://slack.pact.io/
UK Gov Lessons Learnt using Contract Testing:
https://technology.blog.gov.uk/2019/01/29/lessons-learnt-using-contract-testing-in-gov-
uk-pay/
Article I wrote about Authentication in Contract Testing:
https://medium.com/dazn-tech/pact-contract-testing-dealing-with-authentication-on-
the-provider-51fd46fdaa78
Installing your Pact Broker on Heroku (outdated version, delete the Gemfile.lock to install
more recent one):
https://github.com/YOU54F/pact-broker-heroku
Atlassian Swagger/Pact Validator:
https://bitbucket.org/atlassian/swagger-mock-validator/src/master/
22
THANKS!
Any questions, please
reach out! I’m happy to
help.
You can find me at:
@bernardobridge
https://medium.com/@bernardobridge
23

More Related Content

PPTX
Data Security and the Hard Outer Shell
PDF
resolvendo problemas de comunicação em equipes distribuídas com bdd
PDF
CodeStock14: Hiding in Plain Sight
PDF
TDD and Simple Design Workshop - Session 1 - November 2018
PDF
6 DevSecOps Hacks (femtech 2019)
PDF
What's in a password
PDF
Gpw 2013, Konstruktive Paranoia, 2013-03-15
PDF
Leading An Open Source Project As A Startup
Data Security and the Hard Outer Shell
resolvendo problemas de comunicação em equipes distribuídas com bdd
CodeStock14: Hiding in Plain Sight
TDD and Simple Design Workshop - Session 1 - November 2018
6 DevSecOps Hacks (femtech 2019)
What's in a password
Gpw 2013, Konstruktive Paranoia, 2013-03-15
Leading An Open Source Project As A Startup

What's hot (9)

PDF
Leading an open source project as a startup
PDF
DevSecOps for Developers: How To Start
PDF
World-Class Testing Development Pipeline for Android
PDF
The 10 Commandments For The Eager Developer
PDF
Open Source Documentation in Four Easy Steps (and one slightly more difficult...
PDF
How to Lose a Dev In 3 Ways
PDF
Karumi Dojo: Kata Maxibon
PDF
Strategies for Distributed Testing
PDF
Check in dance
Leading an open source project as a startup
DevSecOps for Developers: How To Start
World-Class Testing Development Pipeline for Android
The 10 Commandments For The Eager Developer
Open Source Documentation in Four Easy Steps (and one slightly more difficult...
How to Lose a Dev In 3 Ways
Karumi Dojo: Kata Maxibon
Strategies for Distributed Testing
Check in dance
Ad

Similar to Get with the Pact - Gotchas of Implementing Contract Testing the right way (20)

PPTX
Contract testing. Isolated testing of microservices with pact.io - Evgeniy Ku...
PDF
Test Smart, not hard
PDF
CDC Tests - Integration Tests cant be made simpler than this!
PDF
Move fast and consumer driven contract test things
PDF
Contract testing | Евгений Кузьмин | CODEiD
PDF
Contract-based Testing Approach as a Tool for Shift Lef
PDF
Integration testing with PACT
PDF
Pacts to the Rescue - Making your microservices play nicely together with Con...
PDF
Microservices: test smarter not harder (LAST Conference 2018)
PPTX
Contract testing: Beyond API functional testing
PDF
Software contracts - Global Enterprise Agile 2023.pdf
PDF
Consumer-Driven Contract Testing
PDF
Deploy with Confidence using Pact Go!
PDF
Microservices. Test smarter, not harder. Voxxed Days 2019
PPTX
Contract testing - isolated testing of microservices - Symfony Camp 2018, Evg...
PDF
2019-01-8 - Consumer Driven Contracts at Codefreeze
PPTX
Testing microservices, contract testing
PDF
Consumer Driven Contracts (DDD Perth 2016)
PDF
Contract Testing Php-pact
PPTX
"Asynchronous" Integration Tests for Microservices - RootConf 2017
Contract testing. Isolated testing of microservices with pact.io - Evgeniy Ku...
Test Smart, not hard
CDC Tests - Integration Tests cant be made simpler than this!
Move fast and consumer driven contract test things
Contract testing | Евгений Кузьмин | CODEiD
Contract-based Testing Approach as a Tool for Shift Lef
Integration testing with PACT
Pacts to the Rescue - Making your microservices play nicely together with Con...
Microservices: test smarter not harder (LAST Conference 2018)
Contract testing: Beyond API functional testing
Software contracts - Global Enterprise Agile 2023.pdf
Consumer-Driven Contract Testing
Deploy with Confidence using Pact Go!
Microservices. Test smarter, not harder. Voxxed Days 2019
Contract testing - isolated testing of microservices - Symfony Camp 2018, Evg...
2019-01-8 - Consumer Driven Contracts at Codefreeze
Testing microservices, contract testing
Consumer Driven Contracts (DDD Perth 2016)
Contract Testing Php-pact
"Asynchronous" Integration Tests for Microservices - RootConf 2017
Ad

Recently uploaded (20)

PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
top salesforce developer skills in 2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
System and Network Administration Chapter 2
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Nekopoi APK 2025 free lastest update
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
How to Migrate SBCGlobal Email to Yahoo Easily
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
top salesforce developer skills in 2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
How to Choose the Right IT Partner for Your Business in Malaysia
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
Softaken Excel to vCard Converter Software.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
System and Network Administration Chapter 2
2025 Textile ERP Trends: SAP, Odoo & Oracle
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Nekopoi APK 2025 free lastest update
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Understanding Forklifts - TECH EHS Solution
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...

Get with the Pact - Gotchas of Implementing Contract Testing the right way

  • 1. GET/ with the Pact Gotchas of implementing Contract Testing the “right” way
  • 2. Bernardo Guerreiro Senior Engineer @ Auth0 Platform Team London, UK (Remote) 2 Twitter: @bernardobridge Medium: https://medium.com/@bernardobridge
  • 3. Workshop Requirements Do I need to know about Pact already? Nope. But it can’t hurt! Do I need a laptop? No. But you can follow with one! 3 Do I need to know Javascript? No. But it would help to understand some of the nuances. All concepts are transferable. @bernardobridge
  • 4. A Commit Story - The Movie https://github.com/bernardobridge/cinema-services-app/ 4 @bernardobridge
  • 6. Part 1 The Curious Case of the Missing Tests Uhm...someone “forgot” to write tests again @bernardobridge
  • 8. Part 2 Finding Testability FFS! Testing is hard. @bernardobridge
  • 10. Key Takeaways ▹ You need testability before you need Pact ▹ Work with developers to achieve that ▹ Mocking dependencies introduces a time related risk - you never know what’s still valid ▹ Integration Testing of Microservices can get very complicated very fast 10 @bernardobridge
  • 11. Part 3 The Dark Pact Contract Testing: a hero without a cape @bernardobridge
  • 13. Key Takeaways ▹ Pact works very similarly to existing mocking, but you are able to verify validity of the contract over time ▹ Your contracts should be as narrow as what your service actually consumes ▹ You can use Matchers to ensure your contracts are well suited ▹ Provider state allows you to inject data you may need to use to be able to replicate calls when verifying the provider ▹ Having consistent naming conventions is important to this workflow 13 @bernardobridge
  • 14. Part 4 V for Version My version is better than your version :P @bernardobridge
  • 16. Key Takeaways ▹ Pact pre-verifies versions for you when it knows the contract hasn’t changed and it had already been successfully verified ▹ Your provider version can’t just change when you release, as that’s too late in the release cycle ▹ You need your provider version to dynamically change with new code commits, so you can use commit sha’s ▹ Application Versions in the Pact world are about what code is running 16 @bernardobridge
  • 17. Part 5 The Instagram Principle Click here to tag your location @bernardobridge
  • 19. Key Takeaways ▹ If versions are about what piece of code is running, tags are about where it is running ▹ Branches are a natural candidate for where the code is running ▹ You can use consumerVersionTags to filter your provider verification results ▹ Think about the verification step triggered by the consumer, and the verification step from normal CI flow as different entities ▹ Make sure you are tagging the latest master Pact with a prod tag after releasing to prod. This lets you guarantee backwards compatibility 19 @bernardobridge
  • 20. Final Thoughts (you must be tired by now) @bernardobridge
  • 21. Getting Started: a few tips Run POC’s Proofs of Concept help establish confidence in the time/resource investment by demonstrating usefulness with minimal investment. Involve Tech Leads and Principals These people have a wide reach in the organization, and can help enforce/nail down implementation, proliferation and technical decisions. Involve SRE/DevOps A lot of the hurdles you will face will be about retrofitting this into a CI/CD pipeline. Get help from the experts in this area. You’ll need it! 21 Become a Champion Be the Champion for adoption of this tool, running workshops, brown bags, POC’s with teams, etc. Create RFC’s/equivalent RFC (Request for Comments) are a good way to centralise knowledge, clear doubts, but also to enforce conventions everyone can adopt. Get business buy-in This is not easy, but if business/product can understand the value of this, resource allocation and help become much easier to obtain. Pact works best if everyone uses it. It should be a company goal. @bernardobridge
  • 22. Useful Links PACT.io Docs: https://docs.pact.io/ Workshop Github Repo: https://github.com/bernardobridge/cinema-services-app Pact Foundation Slack Channel: https://slack.pact.io/ UK Gov Lessons Learnt using Contract Testing: https://technology.blog.gov.uk/2019/01/29/lessons-learnt-using-contract-testing-in-gov- uk-pay/ Article I wrote about Authentication in Contract Testing: https://medium.com/dazn-tech/pact-contract-testing-dealing-with-authentication-on- the-provider-51fd46fdaa78 Installing your Pact Broker on Heroku (outdated version, delete the Gemfile.lock to install more recent one): https://github.com/YOU54F/pact-broker-heroku Atlassian Swagger/Pact Validator: https://bitbucket.org/atlassian/swagger-mock-validator/src/master/ 22
  • 23. THANKS! Any questions, please reach out! I’m happy to help. You can find me at: @bernardobridge https://medium.com/@bernardobridge 23