testing microservices with consumer-driven …...•introducing microservices testing challenges •...
TRANSCRIPT
![Page 1: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/1.jpg)
Testing Java Microservices with Consumer-driven contracts
Andrew Morgan @mogronalol
![Page 2: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/2.jpg)
Microservices testing is hard
![Page 3: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/3.jpg)
Consumer driven contract testing
![Page 4: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/4.jpg)
Andrew Morgan @mogronalol
• Independent Consultant specialising in microservices & continuous delivery
• PluralSight Author • InfoQ Editor
About Me
![Page 5: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/5.jpg)
• Introducing microservices testing challenges
• Consumer-driven contract testing overview
• Following through the workflow with Spring Cloud Contract
• Advanced consumer-driven contract concepts
Agenda
![Page 6: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/6.jpg)
• Introducing microservices testing challenges
• Consumer-driven contract testing overview
• Following through the workflow with Spring Cloud Contract
• Advanced consumer-driven contract concepts
Agenda
![Page 7: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/7.jpg)
Payments
Accounts
Loans
What are Microservices?
Rewards
![Page 8: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/8.jpg)
HTTP
HTTP
Payments
Accounts
Loans
What are Microservices?
Rewards
![Page 9: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/9.jpg)
MessagingHTTP
HTTP
Payments
Accounts
Loans
What are Microservices?
Rewards
![Page 10: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/10.jpg)
![Page 11: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/11.jpg)
The root cause of testing challenges
Payments
REST API
Booking
![Page 12: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/12.jpg)
End-to-end Testing Microservices
Automated tests Browser or other UI Environment
![Page 13: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/13.jpg)
Build time
Debuggability
Infrastructure cost
Operations
Flakiness
Distributed monolith
Disadvantages of End-to-end Testing
![Page 14: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/14.jpg)
Automated tests Microservice Mock or Stub of Dependency
Mocking or Stubbing Dependencies
![Page 15: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/15.jpg)
False positives
Staleness
Difficult to maintain
Disadvantages of Mocking or Stubbing
![Page 16: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/16.jpg)
The Weak Feedback Loop
Run individual microservice
testsBuild and deploy
to stage End-to-end test
False positives
Release
Slow and flaky
![Page 17: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/17.jpg)
![Page 18: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/18.jpg)
• Introducing microservices testing challenges
• Consumer-driven contract testing overview
• Following through the workflow with Spring Cloud Contract
• Advanced consumer-driven contract concepts
Agenda
![Page 19: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/19.jpg)
What is Consumer-driven Contract Testing?
Fills the microservices testing gap
Continuous testing against contracts
Consumers drive the implementation of providers
Independently testable and releasable microservices
![Page 20: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/20.jpg)
???
Test Architecture Overview
Consumer Provider
![Page 21: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/21.jpg)
![Page 22: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/22.jpg)
Key Contract Characteristics
An agreed interaction between microservices
Continuously tested
No specific protocol
Not the same stubbing!
Definitely not API documentation!
![Page 23: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/23.jpg)
What is an Interaction?
Scenario:
Should return no flights between London and Paris
![Page 24: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/24.jpg)
What is an Interaction?
Scenario:
Should return no flights between London and Paris
Required Request:
GET /flights?from=London&to=Paris
![Page 25: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/25.jpg)
What is an Interaction?
Scenario:
Should return no flights between London and Paris
Required Request:
GET /flights?from=London&to=Paris
Given Response:
200 []
![Page 26: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/26.jpg)
The Consumer Side
Automated tests
Consuming Microservice
Stub of provider microservice
Generates
The interaction our test depends on
![Page 27: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/27.jpg)
The Provider Side
Pre-defined contract
Providing Microservice
Contract verification tests
Generates
![Page 28: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/28.jpg)
Fast and reliable feedback
Less money spent on infrastructure
API delivers exactly what is required
Understanding dependency hell
No stale stubs
Easy to work in parallel
The Benefits
![Page 29: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/29.jpg)
• Introducing microservices testing challenges
• Consumer-driven contract testing overview
• Following through the workflow with Spring Cloud Contract
• Advanced consumer-driven contract concepts
Agenda
![Page 30: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/30.jpg)
![Page 31: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/31.jpg)
Spring Cloud Contract Overview
JVM-based CDC framework
Spring Boot Integration
Groovy Based Contract Definition Language
Message-driven and HTTP-driven interactions
![Page 32: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/32.jpg)
Credit Card Application Feature
![Page 33: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/33.jpg)
Credit Card Application Feature
JUnit Test Credit card applications service
Credit score service
![Page 34: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/34.jpg)
Credit Card Application Feature
JUnit Test Credit card applications service
Credit score service
Applies for credit card
![Page 35: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/35.jpg)
Credit Card Application Feature
JUnit Test Credit card applications service
Credit score service
Calculates credit score
![Page 36: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/36.jpg)
Credit Card Application Feature
JUnit Test Credit card applications service
Credit score service
Accepts or rejects based on credit score
![Page 37: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/37.jpg)
Following the CDC Workflow
Write a failing test
Define Contract
Build stubs
Make tests pass
Build verification
tests
Make tests pass
![Page 38: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/38.jpg)
Following the CDC Workflow
Write a failing test
![Page 39: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/39.jpg)
A Failing Test
![Page 40: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/40.jpg)
A Failing Test
![Page 41: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/41.jpg)
A Failing Test
![Page 42: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/42.jpg)
Implementing Our Endpoint
JUnit Test
![Page 43: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/43.jpg)
JUnit Test Credit card applications service
Implementing Our Endpoint
![Page 44: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/44.jpg)
JUnit Test Credit card applications service
Credit score service
Does not exist
Implementing Our Endpoint
![Page 45: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/45.jpg)
JUnit Test Credit card applications service
Credit score service
Implementing Our Endpoint
Fails here
![Page 46: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/46.jpg)
Following the CDC Workflow
Write a failing test
Define Contract
![Page 47: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/47.jpg)
Contract Definition Language
Request made by our test
Response expected by our test
![Page 48: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/48.jpg)
Following the CDC Workflow
Write a failing test
Define Contract
Build stubs
![Page 49: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/49.jpg)
Stub Generation
Contract Spring Cloud Contract Plugin
Stub Jar
![Page 51: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/51.jpg)
Following the CDC Workflow
Write a failing test
Define Contract
Build stubs
Make tests pass
![Page 52: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/52.jpg)
The Stub Runner
Download given stubs
Boots WireMock
Imports stubs into Wiremock
![Page 53: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/53.jpg)
From a Failing Test
Unit test Credit card applications service
Credit score service
Fails here
![Page 54: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/54.jpg)
…to a Passing Test
Unit test Credit card applications service
Spring Cloud Contract Stub
Passes here
![Page 55: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/55.jpg)
Following the CDC Workflow
Write a failing test
Define Contract
Build stubs
Make tests pass
Build verification
tests
![Page 56: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/56.jpg)
Provider Test Generation
Contract Spring Cloud Contract Plugin
Verification Tests
![Page 57: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/57.jpg)
![Page 58: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/58.jpg)
![Page 59: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/59.jpg)
![Page 60: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/60.jpg)
Following the CDC Workflow
Write a failing test
Define Contract
Build stubs
Make tests pass
Build verification
tests
Make tests pass
![Page 61: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/61.jpg)
From Failing…
Contract Verification Tests
Credit score service
![Page 62: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/62.jpg)
To Passing…
Contract Verification Tests
Credit score service
Implement me
![Page 63: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/63.jpg)
- Marcin Grzejszczak
“Consumer-driven contracts are like TDD applied at the API level.”
![Page 64: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/64.jpg)
• Introducing microservices testing challenges
• Consumer-driven contract testing overview
• Following through the workflow with Spring Cloud Contract
• Advanced consumer-driven contract concepts
Agenda
![Page 65: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/65.jpg)
Does this only work with exact comparisons?
![Page 66: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/66.jpg)
Regex
JSON
XML
XPath
Subsets
Starts with
Ignore casing
More
![Page 67: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/67.jpg)
What about messaging?
![Page 68: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/68.jpg)
Message-driven CDC
Consumer Provider
![Page 69: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/69.jpg)
Message-driven CDC
Consumer ProviderBroker
![Page 70: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/70.jpg)
Why Messaging?
Message schemas and queues are shared
Asynchronous failures are a debugging nightmare!
Brokers are slow
![Page 71: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/71.jpg)
Where do we store our contracts?
![Page 72: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/72.jpg)
Contract Repository
![Page 73: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/73.jpg)
Contract Repository
![Page 74: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/74.jpg)
Talk Summary
Don’t build and test microservices like a monolith
Consumer-driven contracts promote independence
Leverage frameworks like Spring Cloud Contract and
Pact
![Page 75: Testing microservices with consumer-driven …...•Introducing microservices testing challenges • Consumer-driven contract testing overview • Following through the workflow with](https://reader035.vdocument.in/reader035/viewer/2022062916/5ec65f4c7e974c37c34bb867/html5/thumbnails/75.jpg)
https://www.pluralsight.com/profile/author/andrew-morgan
Questions?
@mogronalol