Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Pacts to the rescue! 
Making your microservices play nicely together ! 
with Consumer Driven Contracts! 
! 
! 
! 
Beth Sku...
! 
! 
“Integrated tests are a scam. ! 
A self replicating virus ! 
that threatens ! 
the very health of your codebase, ! 
...
Integrated Tests: The Problems 
" Slow! 
" Easy to break! 
" Hard to fix! 
" Scales combinatorially 
3 classes, 4 code pat...
Test Symmetry… how it works 
A B 
mock
Test 
1 
Test 
2 
Test 
3 
Integrated tests
Test Symmetry: The Problem 
" Lack of automated tools! 
" Relies on developer eternal vigilance! 
" Does not scale
Posed to Dius 
Do we have the technology to achieve test 
symmetry?
System Integration Tests: The WORST 
" Slower! 
" Easier to break! 
" Harder to fix! 
" Scales BADLY 
" Lots of set up! 
"...
Pact to the rescue!!!
Pact… how it works 
C A P 
B 
mock 
pact
Problems with... Solved by Pact 
Test symmetry! 
" No automated tools! 
" Relies on developer eternal 
vigilance - not sus...
Better API design!
Arrange - set up mock server
Arrange - set up expectations
Act and Assert
Set up provider
Set up test data 
Consumer assumed: 
Provider complies:
Verify: Success!
What’s in it for me? 
• Black box testing - quicker turn around for builds! 
• Exploratory testing - hints as to design 
w...
“How is it working for you?” 
Before Pact! 
" A “certification” environment that took 2 months to set up! 
" Deploy all th...
In summary... 
Consumer Provider 
UI App 
Provid 
er 
Client 
API App DB 
Integrated test 
Test symmetry 
with Pact
Pact allows you to: 
" Reduce your defect turn around time! 
" Reduce the number of bugs that are committed into the 
code...
Pact! 
! 
Makes your microservices play nicely together ! 
with Consumer Driven Contracts! 
! 
github.com/realestate-com-a...
P 
publish pact latest pact? 
tag “prod” pact 
deploy 
script 
prod pact? 
C 
Pact 
Broker
Pacts to the Rescue - Making your microservices play nicely together with Consumer Driven Contracts
Pacts to the Rescue - Making your microservices play nicely together with Consumer Driven Contracts
Prochain SlideShare
Chargement dans…5
×

Pacts to the Rescue - Making your microservices play nicely together with Consumer Driven Contracts

2 759 vues

Publié le

Slides from Let's test Oz

Publié dans : Logiciels
  • Soyez le premier à commenter

Pacts to the Rescue - Making your microservices play nicely together with Consumer Driven Contracts

  1. 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. 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. 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
  4. 4. Test Symmetry… how it works A B mock
  5. 5. Test 1 Test 2 Test 3 Integrated tests
  6. 6. Test Symmetry: The Problem " Lack of automated tools! " Relies on developer eternal vigilance! " Does not scale
  7. 7. Posed to Dius Do we have the technology to achieve test symmetry?
  8. 8. System Integration Tests: The WORST " Slower! " Easier to break! " Harder to fix! " Scales BADLY " Lots of set up! " Flakey! " Extra infrastructure
  9. 9. Pact to the rescue!!!
  10. 10. Pact… how it works C A P B mock pact
  11. 11. Problems with... Solved by Pact Test symmetry! " No automated tools! " Relies on developer eternal vigilance - not sustainable! " Does not scale! ! Integrated tests! " Slow! " Easy to break! " Hard to fix! " Scales combinatorially Test symmetry! " Automatically enforced! ! Integrated tests! " Fast! " Low set up! " Reliable! " Easier to debug! " Standalone CI build! " No extra infrastructure! " Scales linearly
  12. 12. Better API design!
  13. 13. Arrange - set up mock server
  14. 14. Arrange - set up expectations
  15. 15. Act and Assert
  16. 16. Set up provider
  17. 17. Set up test data Consumer assumed: Provider complies:
  18. 18. Verify: Success!
  19. 19. What’s in it for me? • Black box testing - quicker turn around for builds! • Exploratory testing - hints as to design weaknesses! • All testing - catch bugs before committing, support for continuous deployment!
  20. 20. “How is it working for you?” Before Pact! " A “certification” environment that took 2 months to set up! " Deploy all the things => deploy new thing => integration tests => pass ? deploy to production : try again! " Does not scale! ! With Pact! " 40+ microservices using Pact! " Green standalone CI builds ? deploy to production
  21. 21. In summary... Consumer Provider UI App Provid er Client API App DB Integrated test Test symmetry with Pact
  22. 22. Pact allows you to: " Reduce your defect turn around time! " Reduce the number of bugs that are committed into the codebase - immediate feedback on potential integration breakages! " Allows you to modify components with agility! " Have confidence that all the services in your system will work together! " Throw away your integration tests!!!
  23. 23. 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
  24. 24. P publish pact latest pact? tag “prod” pact deploy script prod pact? C Pact Broker

×