SlideShare a Scribd company logo
1 of 70
Download to read offline
1
Microservices.
Test smarter, not harder.
Beth Skurrie (DiUS)
@bethesque
#VoxxedAus2019
A big problem
Problem:
Long time to market
Microservices!
Solved a problem!
New problem...
WHAT WE ARE KNOWN FOR
6
Microservices
Solved problems New problems
● E2E integration tests
○ Slow tests
○ Easy to break
○ Hard to fix
○ Scale badly
○ Lots of set up
○ Flakey tests ignored
○ Takes dev time away
from features
● Feature time to market
A STORY @bethesque
7
@bethesque
To E2E test, or not to E2E test?
A STORY
8
@bethesque
What if there was another way?
9
C P
mock
ANOTHER WAY @bethesque
Consumer tests Provider tests
Integration test
WHAT WE ARE KNOWN FOR
10
Test symmetry
Solved problems New problems
● Hard to keep both sides in
sync
● Fast feedback
● Few dependencies
● No dedicated environment
● Reliable
● Easy to debug
ANOTHER WAY @bethesque
11
C P
mock
ANOTHER WAY @bethesque
12
C P
mock
ANOTHER WAY @bethesque
PPCC
mock
contract
ANOTHER WAY @bethesque
Consumer tests Provider tests
Integration test
14
Message Contract
OTHER TOOLS
C P
contract
@bethesque
WHAT WE ARE KNOWN FOR
15
Contracts
Solved problems New problems
● ???● Keeping tests in sync
ANOTHER WAY @bethesque
How long between writing the
code and finding the bug?
Local
tests
Isolated CI
tests
Deploy E2E
tests
5 mins 15 mins 45 mins 1 hour +
Find
bug
here!
Not
here!
@bethesque
Find integration bugs
early and quickly
Contracts tests
ANOTHER WAY @bethesque
Know before you
commit
Contracts tests
ANOTHER WAY @bethesque
Make changes with
speed and confidence
Contracts tests
ANOTHER WAY @bethesque
Deploy independently
Contracts tests
ANOTHER WAY @bethesque
Better API design
(Consumer)
Contracts tests
ANOTHER WAY @bethesque
Are not functional tests
Contracts tests
ANOTHER WAY @bethesque
Are not an API
specification
Contracts tests
ANOTHER WAY @bethesque
Are not good for “public”
APIs (many, unknown
consumers)
(Consumer)
Contracts tests
ANOTHER WAY @bethesque
Are not a silver bullet!
Contracts tests
ANOTHER WAY @bethesque
27
@bethesque
Business value
Code correctness
28
@bethesque
The Testing Pyramid of Hell
29
@bethesque
WHAT WE ARE KNOWN FOR
30
Speed up your releases
Do less Do more
● Contract testing
● Aggregated logging
● Metrics
● Semantic monitoring
● Alerting
● Correlation IDs
● Integration testing
ANOTHER WAY @bethesque
My contract
testing journey
32
@bethesque
● Open source
● Multiple languages
○ JVM
○ .NET
○ Javascript
○ Python
○ Go
○ + more
pact.io
● HTTP contracts
● Message contracts
33
A B
mock
C P
contract
A CONTRACT TESTING JOURNEY @bethesque
34
A CONTRACT TESTING JOURNEY @bethesque
35
@bethesque
Too many microservices?
You need another microservice!
A CONTRACT TESTING JOURNEY
36
Pact Broker
A CONTRACT TESTING JOURNEY @bethesque
37
@bethesque
Problem 1: Contract exchange
Solution: Pact Broker
A CONTRACT TESTING JOURNEY
38
@bethesque
WHEN
the provider receives
<some request>
THEN
it will return
<some response>
A CONTRACT TESTING JOURNEY
39
@bethesque
WHEN
the provider receives
a GET request for /alligators/Mary
THEN
it will return
a 200 OK response
with a JSON body {“name”: “Mary”}
A CONTRACT TESTING JOURNEY
40
@bethesque
WHEN
the provider receives
a GET request for /alligators/Mary
THEN
it will return
a 404 Not Found
response
a 200 OK
response
A CONTRACT TESTING JOURNEY
41
@bethesque
GIVEN
<the provider is in a certain state>
WHEN
the provider receives
<some request>
THEN
it will return
<some response>
A CONTRACT TESTING JOURNEY
42
@bethesque
Problem 2: Data setup, code coverage
Solution: Provider states
A CONTRACT TESTING JOURNEY
A contract testing
journey
● Automate the contract exchange
● You still need to think about test
data
A CONTRACT TESTING JOURNEY @bethesque
44
@bethesque
Problem 3: brittle tests
A CONTRACT TESTING JOURNEY
45
@bethesque
Problem 3: brittle tests
Solution: flexible matching
A CONTRACT TESTING JOURNEY
A contract testing
journey
● Automate the contract exchange
● You still need to think about test data
● Contracts should focus on the
messages, not the technology
● Contracts should be as flexible as
possible - but no more
A CONTRACT TESTING JOURNEY @bethesque
47
@bethesque
Problem 4: Dealing with
contract changes
A CONTRACT TESTING JOURNEY
48
@bethesque
The other service needs to know when a
contract has changed
Contracts are not a substitute for good
communication between teams
A CONTRACT TESTING JOURNEY
49
@bethesque
Pact Broker webhooks
A CONTRACT TESTING JOURNEY
50
@bethesque
Contracts are STILL not a substitute for
good communication between teams
A CONTRACT TESTING JOURNEY
● Automate the contract exchange
● You still need to think about test data
● Contracts should focus on the
messages, not the technology
● Contracts should be as flexible as
possible - but no more
● The provider needs to know when a
contract has changed
● Remember: contracts are not a
substitute for good communication
between teams
A contract testing
journey
A CONTRACT TESTING JOURNEY @bethesque
52
A CONTRACT TESTING JOURNEY @bethesque
53
@bethesque
Problem 5: Communicating
verification results back to
consumer
A CONTRACT TESTING JOURNEY
54
@bethesque
Pact Broker verifications
A CONTRACT TESTING JOURNEY
55
@bethesqueA CONTRACT TESTING JOURNEY
56
@bethesqueA CONTRACT TESTING JOURNEY
57
@bethesque
If you can’t deploy your services
independently,
you don’t have microservices.
You have a distributed monolith.
A CONTRACT TESTING JOURNEY
Contract
tests
E2E
tests
58
@bethesque
If you can’t deploy your services
independently,
you don’t have microservices.
You have a distributed monolith.
A CONTRACT TESTING JOURNEY
59
@bethesque
If you can’t deploy your services
independently,
you don’t have microservices.
You have a distributed monolith.
A CONTRACT TESTING JOURNEY
Warning!
Do not build a
distributed monolith
60
Consumer
version
Provider
version
Verification
result
11 54 success
12 54 failure
12 55 success
13 56 success
13 57 failure
“The Matrix”
A CONTRACT TESTING JOURNEY @bethesque
61
Consumer
version
Provider
version
Verification
result
11 ✓ 54 PROD. success
12 54 failure
12 55 success
13 56 success
13 57 unknown
Can I deploy?
A CONTRACT TESTING JOURNEY @bethesque
62
A CONTRACT TESTING JOURNEY @bethesque
63
A CONTRACT TESTING JOURNEY @bethesque
64
@bethesque
What about Swagger/OAS?
OTHER TOOLS
65
Provider contracts
OTHER TOOLS @bethesque
66
Consumer contracts
OTHER TOOLS @bethesque
67
A B
mock/write
C P
pact swagger
verify
verify
Pact+Swagger
OTHER TOOLS @bethesque
● OAS support
● Improved Broker workflow
What are the next
problems to
solve for
Pact?
ANOTHER WAY @bethesque
WHAT WE ARE KNOWN FOR
69
Contracts
Solved problems New problems
● ???● Shipping code faster
@bethesque
70
pact.io
pactflow.io
slack.pact.io
@pact_up
Microservices.
Test smarter, not harder
Beth Skurrie (DiUS)
@bethesque
#VoxxedAus2019

More Related Content

What's hot

Awx user guide
Awx user guideAwx user guide
Awx user guide
mspirko
 
Expose your event-driven data to the outside world using webhooks powered by ...
Expose your event-driven data to the outside world using webhooks powered by ...Expose your event-driven data to the outside world using webhooks powered by ...
Expose your event-driven data to the outside world using webhooks powered by ...
HostedbyConfluent
 

What's hot (20)

Airflow Clustering and High Availability
Airflow Clustering and High AvailabilityAirflow Clustering and High Availability
Airflow Clustering and High Availability
 
Introducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes OperatorIntroducing the Apache Flink Kubernetes Operator
Introducing the Apache Flink Kubernetes Operator
 
Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft
Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft
Manchester MuleSoft Meetup #6 - Runtime Fabric with Mulesoft
 
Handling eventual consistency in a transactional world with Matteo Cimini and...
Handling eventual consistency in a transactional world with Matteo Cimini and...Handling eventual consistency in a transactional world with Matteo Cimini and...
Handling eventual consistency in a transactional world with Matteo Cimini and...
 
Toi uu hoa he thong 30 trieu nguoi dung
Toi uu hoa he thong 30 trieu nguoi dungToi uu hoa he thong 30 trieu nguoi dung
Toi uu hoa he thong 30 trieu nguoi dung
 
KSQL Performance Tuning for Fun and Profit ( Nick Dearden, Confluent) Kafka S...
KSQL Performance Tuning for Fun and Profit ( Nick Dearden, Confluent) Kafka S...KSQL Performance Tuning for Fun and Profit ( Nick Dearden, Confluent) Kafka S...
KSQL Performance Tuning for Fun and Profit ( Nick Dearden, Confluent) Kafka S...
 
Building an analytics workflow using Apache Airflow
Building an analytics workflow using Apache AirflowBuilding an analytics workflow using Apache Airflow
Building an analytics workflow using Apache Airflow
 
Apache Airflow overview
Apache Airflow overviewApache Airflow overview
Apache Airflow overview
 
Awx user guide
Awx user guideAwx user guide
Awx user guide
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive


 
Expose your event-driven data to the outside world using webhooks powered by ...
Expose your event-driven data to the outside world using webhooks powered by ...Expose your event-driven data to the outside world using webhooks powered by ...
Expose your event-driven data to the outside world using webhooks powered by ...
 
Combining Logs, Metrics, and Traces for Unified Observability
Combining Logs, Metrics, and Traces for Unified ObservabilityCombining Logs, Metrics, and Traces for Unified Observability
Combining Logs, Metrics, and Traces for Unified Observability
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
 
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
Kubernetes Networking | Kubernetes Services, Pods & Ingress Networks | Kubern...
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API Details
 
Why kubernetes matters
Why kubernetes mattersWhy kubernetes matters
Why kubernetes matters
 
Airflow - a data flow engine
Airflow - a data flow engineAirflow - a data flow engine
Airflow - a data flow engine
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
 
Kafka Streams: What it is, and how to use it?
Kafka Streams: What it is, and how to use it?Kafka Streams: What it is, and how to use it?
Kafka Streams: What it is, and how to use it?
 

Similar to Microservices. Test smarter, not harder. Voxxed Days 2019

Similar to Microservices. Test smarter, not harder. Voxxed Days 2019 (20)

Microservices: test smarter not harder (LAST Conference 2018)
Microservices: test smarter not harder (LAST Conference 2018)Microservices: test smarter not harder (LAST Conference 2018)
Microservices: test smarter not harder (LAST Conference 2018)
 
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd   seven years afterIan Cooper webinar for DDD Iran: Kent beck style tdd   seven years after
Ian Cooper webinar for DDD Iran: Kent beck style tdd seven years after
 
5 Steps to Detecting Issues Earlier in Your Release Cycles
 5 Steps to Detecting Issues Earlier in Your Release Cycles 5 Steps to Detecting Issues Earlier in Your Release Cycles
5 Steps to Detecting Issues Earlier in Your Release Cycles
 
Effective Testing Practices in an Agile Environment
Effective Testing Practices in an Agile EnvironmentEffective Testing Practices in an Agile Environment
Effective Testing Practices in an Agile Environment
 
BoSUSA23 | Chris Spiek & Justin Dickow | Autobooks Product & Engineering
BoSUSA23 | Chris Spiek & Justin Dickow | Autobooks Product & EngineeringBoSUSA23 | Chris Spiek & Justin Dickow | Autobooks Product & Engineering
BoSUSA23 | Chris Spiek & Justin Dickow | Autobooks Product & Engineering
 
Software quality - no more bugs!
Software quality - no more bugs!Software quality - no more bugs!
Software quality - no more bugs!
 
Protractor: Tips & Tricks
Protractor: Tips & TricksProtractor: Tips & Tricks
Protractor: Tips & Tricks
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
 
Westrich spock-assets-gum
Westrich spock-assets-gumWestrich spock-assets-gum
Westrich spock-assets-gum
 
Delivering react app with confidence: Testing Pyramid
Delivering react app with confidence: Testing PyramidDelivering react app with confidence: Testing Pyramid
Delivering react app with confidence: Testing Pyramid
 
2019-01-8 - Consumer Driven Contracts at Codefreeze
2019-01-8 - Consumer Driven Contracts at Codefreeze2019-01-8 - Consumer Driven Contracts at Codefreeze
2019-01-8 - Consumer Driven Contracts at Codefreeze
 
Consumer driven contracts
Consumer driven contractsConsumer driven contracts
Consumer driven contracts
 
How to Better Manage Technical Debt While Innovating on DevOps
How to Better Manage Technical Debt While Innovating on DevOpsHow to Better Manage Technical Debt While Innovating on DevOps
How to Better Manage Technical Debt While Innovating on DevOps
 
Blockchain in enterprise - Challenges, Considerations and Designs
Blockchain in enterprise - Challenges, Considerations and DesignsBlockchain in enterprise - Challenges, Considerations and Designs
Blockchain in enterprise - Challenges, Considerations and Designs
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
 
Magento Live 2014 Customer Expectation Presentation
Magento Live 2014 Customer Expectation PresentationMagento Live 2014 Customer Expectation Presentation
Magento Live 2014 Customer Expectation Presentation
 
Intro to TDD & BDD
Intro to TDD & BDDIntro to TDD & BDD
Intro to TDD & BDD
 
ITB2015 - Behavior Driven Development, Automation and Continuous Integration
ITB2015 - Behavior Driven Development, Automation and Continuous IntegrationITB2015 - Behavior Driven Development, Automation and Continuous Integration
ITB2015 - Behavior Driven Development, Automation and Continuous Integration
 
2015 in tothebox-introtddbdd
2015 in tothebox-introtddbdd2015 in tothebox-introtddbdd
2015 in tothebox-introtddbdd
 
Pull requests do's and don'ts
Pull requests do's and don'tsPull requests do's and don'ts
Pull requests do's and don'ts
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Microservices. Test smarter, not harder. Voxxed Days 2019