SlideShare a Scribd company logo
Testing Microservices:
From Development to Production
Daniel Bryant
@danielbryantuk
Rube Goldberg’s self-operating napkin
09/10/2018 @danielbryantuk
Was Rube Goldberg the first microservice architect?
09/10/2018 @danielbryantuk
tl;dr
• A lot of microservice testing attempts I see are at the fringes of a
spectrum from “YOLO” to seeking absolute correctness
• I believe the key tradeoffs should be around pre-prod vs post-prod tests
• Contract testing, API simulation and chaos experimentation can be useful
techniques for microservice testing
09/10/2018 @danielbryantuk
@danielbryantuk
• Independent Technical Consultant, Product Architect at Datawire
• Architecture, DevOps, Java, microservices, cloud, containers
• Continuous Delivery (CI/CD) advocate
• Leading change through technology and teams
09/10/2018 @danielbryantuk
bit.ly/2jWDSF7
oreil.ly/2E63nCR
Testing microservice 101
09/10/2018 @danielbryantuk
Testing: Core concepts
09/10/2018 @danielbryantuk
/lisacrispin.com/2011/11/08/using-the-agile-testing-quadrants/martinfowler.com/bliki/TestPyramid.html
The test pyramid (is just a model)
• This model was created before the
rise in popularity of microservices…
• …but after David Parnas’ modularity
• Applies at system and service level
• Probably needs updating…
09/10/2018 @danielbryantuk
martinfowler.com/bliki/TestPyramid.html
New testing strategies for microservices
09/10/2018 @danielbryantuk
https://medium.com/@copyconstruct/testing-microservices-the-sane-way-9bb31d158c16 http://distributed-systems-observability-ebook.humio.com/
Microservice test funnel
09/10/2018 @danielbryantuk
https://medium.com/@copyconstruct/testing-microservices-the-sane-way-9bb31d158c16
General lessons learned
(and mistakes made)
09/10/2018 @danielbryantuk
I’m not suggesting that you avoid unit tests
09/10/2018 @danielbryantuk
https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-yuan.pdf https://www.youtube.com/watch?v=ZMbqbXxRthE
I’m not suggesting that you avoid unit tests
• 77% of production failures can be
reproduced by a unit test
• Testing error handling code could
have prevented 58% of catastrophic
failures
• 35% of catastrophic failures
• Empty error handler, or contains FIXME
• Error handler aborts system
09/10/2018 @danielbryantuk
https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-yuan.pdf
Integration/component tests
If your component/integration tests look too complicated,
they probably are
Coupling and cohesion apply to everything!
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
https://itnext.io/microservice-testing-coupling-and-cohesion-all-the-way-down-a9f100cda523
End-to-end tests
Representational data is often the weakest link
Understand your data ”shape” and volume
09/10/2018 @danielbryantuk
Synthetic datastores/middleware
09/10/2018 @danielbryantuk
General strategies
• Test outside-in
• Acceptance tests for system and services
• “LUFD” the context and TDD the API
• Virtualise dependencies
• Test contracts of unstable APIs
• Invest in monitoring, synthetic txns and
chaos engineerings (in this order)
09/10/2018 @danielbryantuk
https://itnext.io/microservice-testing-coupling-and-cohesion-all-the-way-down-a9f100cda523
Let’s look at some techniques in more depth
09/10/2018 @danielbryantuk
Contract
(Testing syntax)
09/10/2018 @danielbryantuk
So, where do contracts fit into this…
09/10/2018 @danielbryantuk
martinfowler.com/bliki/TestPyramid.html
Contract Tests Focused on system
Focused on service/function
API contracts
• APIs are service contracts
• Many are producer-driven
• It’s possible to design outside-in:
• Consumer-Driven Contracts
• martinfowler.com/articles/consumerDrivenContracts.html
09/10/2018 @danielbryantuk
CDC concepts
09/10/2018 @danielbryantuk
https://codefresh.io/docker-tutorial/how-to-test-microservice-integration-with-pact/
CDC workflow
1. Consumer writes a contract that defines an interaction with the API.
1. For HTTP RPC this is simply request with acceptable params and response
2. Often the contract can be autogenerated from a test
2. Consumer issues a pull request to producer containing the contract
3. Producer runs the SUT (via pipeline) and tests if the contract is valid
1. If yes, then simply accept the pull request
2. If no, then modify the SUT to meet the contract (this often involves inter-
team communication), and then accept the pull request
4. Producer deploys (via pipeline), and consumer deploys (via pipeline)
1. Take care in regards to backwards compatibility
09/10/2018 @danielbryantuk
1.
2. 3. 4.
4.
CDC frameworks
09/10/2018 @danielbryantuk
docs.pact.io
cloud.spring.io/spring-cloud-contract
github.com/spring-cloud-samples/spring-cloud-contract-samples
CDC for messaging
• What about messaging?
• Message schema are an API
• Pact supports AMQP contracts
• www.infoq.com/presentations/contracts-streaming-microservices
09/10/2018 @danielbryantuk
CDC for messaging
09/10/2018 @danielbryantuk
www.infoq.com/presentations/contracts-streaming-microservices
docs.confluent.io/current/schema-registry/docs/maven-plugin.html
Contract testing musings
• Great in low trust or poor communication organisations
• Act as a cue for a conversation
• Can be used to implement TDD for the API
• Resource intensive to create and maintain
09/10/2018 @danielbryantuk
API Simulation
(Testing semantics)
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
API simulation musings
• Great when a dependency is “expensive” to access or tricky to mock
• Useful when failure modes of dependency are hard to recreate
• Simulations can be fragile and/or complicated
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
Fault injection
(Testing resilience)
09/10/2018 @danielbryantuk
When engineers hear the phrase “chaos engineering”
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
When non technical folk hear the phrase “chaos engineering”
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
09/10/2018 @danielbryantuk
https://principlesofchaos.org/
09/10/2018 @danielbryantuk
https://chaostoolkit.org/
09/10/2018 @danielbryantuk
https://www.gremlin.com/ https://www.infoq.com/news/2018/10/gremlin-alfi
Chaos engineering prerequisites
Tammy Butow’s three prerequisites:
1. High severity incident management
2. Monitoring
3. Measure the impact of downtime
09/10/2018 @danielbryantuk
https://www.infoq.com/news/2018/03/resilient-systems-chaos-engineer
Chaos engineering prerequisites
09/10/2018 @danielbryantuk
https://www.infoq.com/news/2018/03/resilient-systems-chaos-engineer
Tammy Butow’s three prerequisites:
1. High severity incident management
2. Monitoring
3. Measure the impact of downtime
Chaos engineering musings
• Great for codifying/asserting system quality attributes
• Can prompt team to think about monitoring and DR/BC
• Can cause a lot of damage if approached casually
09/10/2018 @danielbryantuk
Wrapping up
09/10/2018 @danielbryantuk
Conclusion
• Try and avoid microservice testing strategies that are solely YOLO or
attempting to seek absolute correctness
• Balance pre-prod (generally technology facing and supporting the team)
vs post-prod tests (generally business facing and critiquing the product)
• Contract testing, API simulation and chaos experimentation can be useful
techniques for microservice testing
09/10/2018 @danielbryantuk
Thanks for listening…
Twitter: @danielbryantuk
Email: daniel.bryant@tai-dev.co.uk
Writing: https://www.infoq.com/profile/Daniel-Bryant
Talks: https://www.youtube.com/playlist?list=PLoVYf_0qOYNeBmrpjuBOOAqJnQb3QAEtM
09/10/2018 @danielbryantuk
oreil.ly/2E63nCR

More Related Content

PPTX
CodeOne 2019: "Continuous Delivery with Docker and Java"
PPTX
Designing a Future-proof API Program
PDF
Eight Hours to API Literacy: A Fast, Fun On-ramp for Writers
PPTX
OpenAPI at Scale
PDF
DevOpsDays Baltimore 2018: A Definition of Done for DevSecOps - Gene Gotimer
PDF
APIdays Singapore 2019 - Bringing OpenAPI to devOps, Vincenzo Chianese, Softw...
PDF
vJUG24 2016 "Seven (More) Deadly Sins of Microservice"
PPTX
deliver:Agile 2019 "Testing Microservices: From Development to Production
CodeOne 2019: "Continuous Delivery with Docker and Java"
Designing a Future-proof API Program
Eight Hours to API Literacy: A Fast, Fun On-ramp for Writers
OpenAPI at Scale
DevOpsDays Baltimore 2018: A Definition of Done for DevSecOps - Gene Gotimer
APIdays Singapore 2019 - Bringing OpenAPI to devOps, Vincenzo Chianese, Softw...
vJUG24 2016 "Seven (More) Deadly Sins of Microservice"
deliver:Agile 2019 "Testing Microservices: From Development to Production

Similar to Jax London 2018: "Testing Microservices from Development to Production" (20)

PPTX
deliver:Agile 2018 "Continuous Delivery Patterns for Modern Architectures"
PDF
Lisbon DevOps: "Seven (More) Deadly Sins of Microservices"
PPTX
jSpring 2018 "Continuous Delivery Patterns for Modern Architectures and Java"
PDF
JAXDevOps 2017 "The Seven (More) Deadly Sins of Microservices
PDF
GOTO Chicago/CraftConf 2017 "The Seven (More) Deadly Sins of Microservices"
PDF
Devoxx US 2017 "The Seven (More) Deadly Sins of Microservices"
PDF
muCon 2016: "Seven (More) Deadly Sins of Microservices"
PDF
OOP/MM 2017: "Seven (More) Deadly Sins of Microservices"
PPTX
[SC London] "Testing Microservices: from Development to Production
PPTX
O'Reilly SACON NY 2018 "Continuous Delivery Patterns for Contemporary Archite...
PDF
Haufe #msaday - Building a Microservice Ecosystem by Daniel Bryant
PDF
Building a microservice ecosystem
PDF
Haufe #msaday: "Building a Microservice Ecosystem"
PPTX
JAX DevOps 2018 "Continuous Delivery Patterns for Modern Architectures"
PDF
TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
PDF
OSCON EU 2016 "Seven (More) Deadly Sins of Microservices"
PDF
Micro Manchester Meetup: "The Seven (More) Deadly Sins of Microservices"
PPTX
microservice testing tools and technologies
PDF
DevOpsNorth 2017 "Seven (More) Deadly Sins of Microservices"
PDF
Microservices - stress-free and without increased heart attack risk
deliver:Agile 2018 "Continuous Delivery Patterns for Modern Architectures"
Lisbon DevOps: "Seven (More) Deadly Sins of Microservices"
jSpring 2018 "Continuous Delivery Patterns for Modern Architectures and Java"
JAXDevOps 2017 "The Seven (More) Deadly Sins of Microservices
GOTO Chicago/CraftConf 2017 "The Seven (More) Deadly Sins of Microservices"
Devoxx US 2017 "The Seven (More) Deadly Sins of Microservices"
muCon 2016: "Seven (More) Deadly Sins of Microservices"
OOP/MM 2017: "Seven (More) Deadly Sins of Microservices"
[SC London] "Testing Microservices: from Development to Production
O'Reilly SACON NY 2018 "Continuous Delivery Patterns for Contemporary Archite...
Haufe #msaday - Building a Microservice Ecosystem by Daniel Bryant
Building a microservice ecosystem
Haufe #msaday: "Building a Microservice Ecosystem"
JAX DevOps 2018 "Continuous Delivery Patterns for Modern Architectures"
TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
OSCON EU 2016 "Seven (More) Deadly Sins of Microservices"
Micro Manchester Meetup: "The Seven (More) Deadly Sins of Microservices"
microservice testing tools and technologies
DevOpsNorth 2017 "Seven (More) Deadly Sins of Microservices"
Microservices - stress-free and without increased heart attack risk
Ad

More from Daniel Bryant (20)

PDF
ITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
PDF
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
PDF
PlatformCon 23: "The Busy Platform Engineers Guide to API Gateways"
PDF
Java Meetup 23: 'Debugging Microservices "Remocally" in Kubernetes with Telep...
PPTX
DevRelCon 2022: "Is Product Led Growth (PLG) the “DevOps” of the DevRel World"
PDF
Fall 22: "From Kubernetes to PaaS to... err, what's next"
PDF
Building Microservice Systems Without Cooking Your Laptop: Going “Remocal” wi...
PDF
KubeCrash 22: Debugging Microservices "Remocally" in Kubernetes with Telepres...
PDF
JAX London 22: Debugging Microservices "Remocally" in Kubernetes with Telepre...
PDF
CloudBuilders 2022: "The Past, Present, and Future of Cloud Native API Gateways"
PDF
KubeCon EU 2022: From Kubernetes to PaaS to Err What's Next
PDF
Devoxx UK 22: Debugging Java Microservices "Remocally" in Kubernetes with Tel...
PDF
DevXDay KubeCon NA 2021: "From Kubernetes to PaaS to Developer Control Planes"
PDF
JAX London 2021: Jumpstart Your Cloud Native Development: An Overview of Prac...
PDF
Container Days: Easy Debugging of Microservices Running on Kubernetes with Te...
PDF
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
PDF
MJC 2021: "Debugging Java Microservices Running on Kubernetes with Telepresence"
PDF
LJC 4/21"Easy Debugging of Java Microservices Running on Kubernetes with Tele...
PDF
GOTOpia 2/2021 "Cloud Native Development Without the Toil: An Overview of Pra...
PPTX
HashiCorp Webinar: "Getting started with Ambassador and Consul on Kubernetes ...
ITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
PlatformCon 23: "The Busy Platform Engineers Guide to API Gateways"
Java Meetup 23: 'Debugging Microservices "Remocally" in Kubernetes with Telep...
DevRelCon 2022: "Is Product Led Growth (PLG) the “DevOps” of the DevRel World"
Fall 22: "From Kubernetes to PaaS to... err, what's next"
Building Microservice Systems Without Cooking Your Laptop: Going “Remocal” wi...
KubeCrash 22: Debugging Microservices "Remocally" in Kubernetes with Telepres...
JAX London 22: Debugging Microservices "Remocally" in Kubernetes with Telepre...
CloudBuilders 2022: "The Past, Present, and Future of Cloud Native API Gateways"
KubeCon EU 2022: From Kubernetes to PaaS to Err What's Next
Devoxx UK 22: Debugging Java Microservices "Remocally" in Kubernetes with Tel...
DevXDay KubeCon NA 2021: "From Kubernetes to PaaS to Developer Control Planes"
JAX London 2021: Jumpstart Your Cloud Native Development: An Overview of Prac...
Container Days: Easy Debugging of Microservices Running on Kubernetes with Te...
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
MJC 2021: "Debugging Java Microservices Running on Kubernetes with Telepresence"
LJC 4/21"Easy Debugging of Java Microservices Running on Kubernetes with Tele...
GOTOpia 2/2021 "Cloud Native Development Without the Toil: An Overview of Pra...
HashiCorp Webinar: "Getting started with Ambassador and Consul on Kubernetes ...
Ad

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Network Security Unit 5.pdf for BCA BBA.
Chapter 3 Spatial Domain Image Processing.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Electronic commerce courselecture one. Pdf
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Monthly Chronicles - July 2025
CIFDAQ's Market Insight: SEC Turns Pro Crypto

Jax London 2018: "Testing Microservices from Development to Production"

Editor's Notes

  • #13: We present the result of a comprehensive study investigating 198 randomly selected, user-reported failures that occurred on Cassandra, HBase, Hadoop Distributed File System (HDFS), Hadoop MapReduce, and Redis, with the goal of understanding how one or multiple faults eventually evolve into a user-visible failure. We found that from a testing point of view, almost all failures require only 3 or fewer nodes to reproduce, which is good news considering that these services typically run on a very large number of nodes. H
  • #14: We present the result of a comprehensive study investigating 198 randomly selected, user-reported failures that occurred on Cassandra, HBase, Hadoop Distributed File System (HDFS), Hadoop MapReduce, and Redis, with the goal of understanding how one or multiple faults eventually evolve into a user-visible failure. We found that from a testing point of view, almost all failures require only 3 or fewer nodes to reproduce, which is good news considering that these services typically run on a very large number of nodes. H