SlideShare a Scribd company logo
1 of 23
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

What's hot

Leading an open source project as a startup
Leading an open source project as a startupLeading an open source project as a startup
Leading an open source project as a startupNicolas Garnier
 
DevSecOps for Developers: How To Start
DevSecOps for Developers: How To StartDevSecOps for Developers: How To Start
DevSecOps for Developers: How To StartPatricia Aas
 
World-Class Testing Development Pipeline for Android
 World-Class Testing Development Pipeline for Android World-Class Testing Development Pipeline for Android
World-Class Testing Development Pipeline for AndroidPedro Vicente Gómez Sánchez
 
The 10 Commandments For The Eager Developer
The 10 Commandments For The Eager DeveloperThe 10 Commandments For The Eager Developer
The 10 Commandments For The Eager DeveloperTsvika Kleinman
 
Open Source Documentation in Four Easy Steps (and one slightly more difficult...
Open Source Documentation in Four Easy Steps (and one slightly more difficult...Open Source Documentation in Four Easy Steps (and one slightly more difficult...
Open Source Documentation in Four Easy Steps (and one slightly more difficult...Lana Brindley
 
How to Lose a Dev In 3 Ways
How to Lose a Dev In 3 WaysHow to Lose a Dev In 3 Ways
How to Lose a Dev In 3 WaysJamie Wittenberg
 
Strategies for Distributed Testing
Strategies for Distributed TestingStrategies for Distributed Testing
Strategies for Distributed TestingvodQA
 

What's hot (9)

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

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

What is the best approach to tdd
What is the best approach to tddWhat is the best approach to tdd
What is the best approach to tddLuca Mattia Ferrari
 
How proof of concept development can be the stepping stone of success
How proof of concept development can be the stepping stone of successHow proof of concept development can be the stepping stone of success
How proof of concept development can be the stepping stone of successEmbitel Technologies (I) PVT LTD
 
Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...
Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...
Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...Dana Gardner
 
Hackathon Blockchain Guide.docx
Hackathon  Blockchain Guide.docxHackathon  Blockchain Guide.docx
Hackathon Blockchain Guide.docxArthur Souza
 
ChatGPT Usage In Software Development – Curse or Boon.pdf
ChatGPT Usage In Software Development – Curse or Boon.pdfChatGPT Usage In Software Development – Curse or Boon.pdf
ChatGPT Usage In Software Development – Curse or Boon.pdfLaura Miller
 
20141111 tinker tuesday prototype to product
20141111 tinker tuesday prototype to product20141111 tinker tuesday prototype to product
20141111 tinker tuesday prototype to productTakeda Pharmaceuticals
 
What is WebRTC? What can I do with it?
What is WebRTC? What can I do with it?What is WebRTC? What can I do with it?
What is WebRTC? What can I do with it?Dan Jenkins
 
Moving to tdd bdd
Moving to tdd bddMoving to tdd bdd
Moving to tdd bddKim Carter
 
ChatGPT usage in software development - curse or boon.pdf
ChatGPT usage in software development - curse or boon.pdfChatGPT usage in software development - curse or boon.pdf
ChatGPT usage in software development - curse or boon.pdfLaura Miller
 
Performance monitoring and call tracing in microservice environments
Performance monitoring and call tracing in microservice environmentsPerformance monitoring and call tracing in microservice environments
Performance monitoring and call tracing in microservice environmentsMartin Gutenbrunner
 
Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...
Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...
Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...Dana Gardner
 
What to prepare before engaging with an offshore team (footnotes included)
What to prepare before engaging with an offshore team (footnotes included)What to prepare before engaging with an offshore team (footnotes included)
What to prepare before engaging with an offshore team (footnotes included)Chris Hote
 
Developer Experience
Developer ExperienceDeveloper Experience
Developer ExperienceThoughtworks
 
What scrum masters and product owners should know about software quality and ...
What scrum masters and product owners should know about software quality and ...What scrum masters and product owners should know about software quality and ...
What scrum masters and product owners should know about software quality and ...STX Next
 
The Anatomy of a Code Review
The Anatomy of a Code ReviewThe Anatomy of a Code Review
The Anatomy of a Code ReviewGuilherme Garnier
 
PHPUnit with Magento
PHPUnit with MagentoPHPUnit with Magento
PHPUnit with MagentoTu Hoang
 
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...Sergii Khomenko
 

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

What is the best approach to tdd
What is the best approach to tddWhat is the best approach to tdd
What is the best approach to tdd
 
How proof of concept development can be the stepping stone of success
How proof of concept development can be the stepping stone of successHow proof of concept development can be the stepping stone of success
How proof of concept development can be the stepping stone of success
 
Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...
Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...
Standards and APIs: How to Best Build Platforms and Tools to Manage Identity ...
 
Hackathon Blockchain Guide.docx
Hackathon  Blockchain Guide.docxHackathon  Blockchain Guide.docx
Hackathon Blockchain Guide.docx
 
ChatGPT Usage In Software Development – Curse or Boon.pdf
ChatGPT Usage In Software Development – Curse or Boon.pdfChatGPT Usage In Software Development – Curse or Boon.pdf
ChatGPT Usage In Software Development – Curse or Boon.pdf
 
20141111 tinker tuesday prototype to product
20141111 tinker tuesday prototype to product20141111 tinker tuesday prototype to product
20141111 tinker tuesday prototype to product
 
What is WebRTC? What can I do with it?
What is WebRTC? What can I do with it?What is WebRTC? What can I do with it?
What is WebRTC? What can I do with it?
 
Moving to tdd bdd
Moving to tdd bddMoving to tdd bdd
Moving to tdd bdd
 
ChatGPT usage in software development - curse or boon.pdf
ChatGPT usage in software development - curse or boon.pdfChatGPT usage in software development - curse or boon.pdf
ChatGPT usage in software development - curse or boon.pdf
 
Performance monitoring and call tracing in microservice environments
Performance monitoring and call tracing in microservice environmentsPerformance monitoring and call tracing in microservice environments
Performance monitoring and call tracing in microservice environments
 
Introduction to TDD and BDD
Introduction to TDD and BDDIntroduction to TDD and BDD
Introduction to TDD and BDD
 
Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...
Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...
Internet of Things Brings On Development Demands That DevOps Manages, Say Exp...
 
9 Proven-Strategies
9 Proven-Strategies9 Proven-Strategies
9 Proven-Strategies
 
What to prepare before engaging with an offshore team (footnotes included)
What to prepare before engaging with an offshore team (footnotes included)What to prepare before engaging with an offshore team (footnotes included)
What to prepare before engaging with an offshore team (footnotes included)
 
Developer Experience
Developer ExperienceDeveloper Experience
Developer Experience
 
Hardening
HardeningHardening
Hardening
 
What scrum masters and product owners should know about software quality and ...
What scrum masters and product owners should know about software quality and ...What scrum masters and product owners should know about software quality and ...
What scrum masters and product owners should know about software quality and ...
 
The Anatomy of a Code Review
The Anatomy of a Code ReviewThe Anatomy of a Code Review
The Anatomy of a Code Review
 
PHPUnit with Magento
PHPUnit with MagentoPHPUnit with Magento
PHPUnit with Magento
 
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...
From Data Science to Production - deploy, scale, enjoy! / PyData Amsterdam - ...
 

Recently uploaded

JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 

Recently uploaded (20)

JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 

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