SlideShare a Scribd company logo
1 of 23
Download to read offline
Christoph Ebeling – Managing Director
April 21, 2022
TESTING MICROSERVICES
AGENDA
‣ Quick overview on testing strategies
‣ Evaluating their eligibility for cloud microservices deployments
‣ Sharing two specific strategies for microservice testing
COMPARING MODES OF TESTING
MANUAL VS. AUTOMATED
Regression Documentation Code quality
FAST IN THE
SHORT RUN
FAST IN
THE
LONG
RUN
Manual testing can be faster in the short run, however:
WHY TESTING SOFTWARE CAN BE CHALLENGING
Ø Tooling
Ø Slow CI Servers
Ø Lack of knowledge about testing framework
Ø Too much effort for low ROI
Ø Bad software architecture / code is hard to
test
WHAT IS THE GOAL OF ALL THIS TESTING?
DEVELOP
TEST
DEPLOY
CAN WE
DEPLOY
WITHOUT
BREAKING
THE SYSTEM?
WHAT DOES
TESTABLE
CODE LOOK
LIKE?
EXAMPLE
▸Text
class User {
int id;
public float getMonthlyNetSpendings() {
ArrayList<Order> orders = OrderService.findByUserId(this.id);
float amount = 0;
for (Order order: orders) {
amount += order.getAmount();
}
return amount;
}
}
Needs Mock
Net or Gross?
TEST TYPES
1 Fast execution
2
3
4
Unit test
Good for complex logic / high
cyclomatic complexity
Not sufficient to ensure software is
working
High effort to maintain
Integration testing
Test the whole application
E2E test / Functional Test
Enables us to deploy with confidence
Hard to cover all edge cases
Painful to write and maintain
Slow
1
2
3
4
5
What would it look like in
a microservice
environment?
EXAMPLE
▸Text
class User {
int id;
public float getMonthlyNetSpendings() {
ArrayList<Order> orders = OrderService.findByUserId(this.id);
float amount = 0;
for (Order order: orders) {
amount += order.getAmount();
}
return amount;
}
}
LET’S TAKE A CLOSER LOOK
Needs Mock
Net or Gross?
TEST TYPES
1 Fast execution
Unit testing
2
Good for complex logic / high
cyclomatic complexity
3
Not sufficient to ensure software is
working
4 High effort to maintain
Integration testing E2E test / Functional testing
Test the whole application
1
Enables us to deploy with confidence
2
Hard to cover all edge cases
3
Painful to write and maintain
4
Slow
5
1 Tests a large part of the application,
including interfaces
2
Is still fast enough on modern
computers
REQUIREMENTS FOR A MICROSERVICE ARCHITECTURE
SERVICES ARE LOOSELY COUPLED.
CAN BE INDEPENDENTLY DEPLOYED.
TEAMS MAY WORK AT DIFFERENT TIMES, DIFFERENT LOCATIONS, NOT ALWAYS ABLE TO COMMUNICATE.
1
2
3
ILLUSTRATION OF MICROSERVICE INTEGRATION TESTING
SERVICE C
SERVICE B
SERVICE A
SERVICE A
TEST
Get
/api-endpoint-1
Post /api-endpoint-2
New feature needs to get
new information from
Service C
Get
/api-endpoint-2
NOT
IMPLEMENTED
CHANGE CAN’T BE MERGED
DEAR TEAM C,
WE’VE CREATED A NEW FEATURE BUT CAN’T DEPLOY
CAUSE YOU’RE MISSING AN API ENDPOINT. PLEASE
CHECKOUT MY BRANCH, THEN RUN MY NEW
CONTAINER, DEPLOY MY NEW FANCY MONGO DB, RUN
SERVICE TEST A AND MAKE SURE EVERYTHING IS FINE.
IT WOULD BE SWEET IF YOU COULD ALSO TEST THE
ERRORS FOR ME. PS: PLS DON’T FORGET TO LOAD MY
FIXTURES, RUN MIGRATION…OH AND HEY, SOMETIMES
SERVICE TEST A TIMES OUT, JUST RERUN IT. IN CASE OF
ANY PROBLEMS FEEL FREE TO HIT UP OUR INTERN.
TEAM A
TEAM C
I WANT MY MOCK BACK!!!
(But this time we do it better……………I promise!!)
WHY WE DIDN’T LIKE MOCKS IN THE FIRST PLACE?
Ø The mocked API could have a different interface
Ø The mocked API could give different results
Ø When the mocked API changes, we won’t notice
SERVICE C
SERVICE B
SERVICE A
SERVICE A TEST Post /api-endpoint-2
New feature needs to get
new information from
Service C
CHANGE CAN’T BE MERGED
TEAM A
TEAM C
API MOCK
DEAR TEAM C,
WE’VE CREATED A NEW FEATURE. I ALREADY TESTED IT WITH
A MOCK (IT WORKS LIKE A CHARM) AND ATTACHED YOU THE
LATEST SWAGGER FILES AS WELL AS MY PAYLOAD AND
EXPECTED JSON. PLS WRITE A UNIT TEST FOR YOUR API,
MAKE IT GREEN, AND LET ME KNOW WHEN YOU’RE DONE.
UNIT TEST
Consumer Driven Contracts
RECAP
WHAT DO WE KNOW SO FAR ?
Ø We covered the business logic of our single services.
Ø We know the services and their compatibility.
Ø We (hopefully) covered all edge cases that our Devs could think about.
WHAT STILL NEEDS TO BE COVERED
WHAT DO WE NOT KNOW ?
Ø Will it work on scale?
Ø Will it work with real user data?
Ø Is there anything our automated tests did not consider?
SERVICE C (V1)
SERVICE B
SERVICE A
SERVICE A TEST Post /api-endpoint-2
CHANGE CAN’T BE MERGED
SERVICE C (V2)
Splits traffic
SERVICE C
Canary deployment with service mesh
SERVICE C
SERVICE B
SERVICE A
SERVICE A TEST Post /api-endpoint-2
CHANGE CAN’T BE MERGED
Message Broker
MESSAGE
BROKER
SERVICE C (V1)
SERVICE B
SERVICE A
SERVICE A TEST Post /api-endpoint-2
CHANGE CAN’T BE MERGED
Canary Deployment with message broker
MESSAGE
BROKER
SERVICE C (V2)
Both get 100% of the traffic
ANY QUESTIONS
CONTACT DETAILS

More Related Content

Similar to Test Strategies for Microservices with Christoph Ebeling

Case Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software DevelopmentCase Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software DevelopmentCA Technologies
 
Case Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software DevelopmentCase Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software DevelopmentCA Technologies
 
Removing Crucial Dependencies to Enable KPN as a Virtual Telecom Provider
Removing Crucial Dependencies to Enable KPN as a Virtual Telecom ProviderRemoving Crucial Dependencies to Enable KPN as a Virtual Telecom Provider
Removing Crucial Dependencies to Enable KPN as a Virtual Telecom ProviderCA Technologies
 
Creative Automation with Galen Framework
Creative Automation with Galen FrameworkCreative Automation with Galen Framework
Creative Automation with Galen Framework'Ashmeet Sehgal'
 
The World Outside - The Blind Spot of TDD
The World Outside - The Blind Spot of TDDThe World Outside - The Blind Spot of TDD
The World Outside - The Blind Spot of TDDAmit Anafy
 
Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...
Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...
Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...C4Media
 
Metrics-Driven Devops: Delivering High Quality Software Faster!
Metrics-Driven Devops: Delivering High Quality Software Faster! Metrics-Driven Devops: Delivering High Quality Software Faster!
Metrics-Driven Devops: Delivering High Quality Software Faster! Dynatrace
 
Accelerate Application Migration - August 5, 2020
Accelerate Application Migration - August 5, 2020Accelerate Application Migration - August 5, 2020
Accelerate Application Migration - August 5, 2020VMware Tanzu
 
Migration to the cloud
Migration to the cloudMigration to the cloud
Migration to the cloudEPAM Systems
 
Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Yan Cui
 
Crystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPICrystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPIScott Triglia
 
Jenkins: Portability Testing & Dealing With Limits
Jenkins: Portability Testing & Dealing With LimitsJenkins: Portability Testing & Dealing With Limits
Jenkins: Portability Testing & Dealing With LimitsClemens Scholz
 
Disruptive Trends in Application Development
Disruptive Trends in Application DevelopmentDisruptive Trends in Application Development
Disruptive Trends in Application DevelopmentWaveMaker, Inc.
 
Software Testing - Online Guide
Software Testing - Online GuideSoftware Testing - Online Guide
Software Testing - Online Guidebigspire
 
Neotys PAC - Stijn Schepers
Neotys PAC - Stijn SchepersNeotys PAC - Stijn Schepers
Neotys PAC - Stijn SchepersNeotys_Partner
 
Business Utility Application
Business Utility ApplicationBusiness Utility Application
Business Utility ApplicationIRJET Journal
 
Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)Michael Elder
 
Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Yan Cui
 

Similar to Test Strategies for Microservices with Christoph Ebeling (20)

Case Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software DevelopmentCase Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software Development
 
Case Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software DevelopmentCase Study: How The Home Depot Built Quality Into Software Development
Case Study: How The Home Depot Built Quality Into Software Development
 
Performance Testing
Performance Testing Performance Testing
Performance Testing
 
Removing Crucial Dependencies to Enable KPN as a Virtual Telecom Provider
Removing Crucial Dependencies to Enable KPN as a Virtual Telecom ProviderRemoving Crucial Dependencies to Enable KPN as a Virtual Telecom Provider
Removing Crucial Dependencies to Enable KPN as a Virtual Telecom Provider
 
Creative Automation with Galen Framework
Creative Automation with Galen FrameworkCreative Automation with Galen Framework
Creative Automation with Galen Framework
 
The World Outside - The Blind Spot of TDD
The World Outside - The Blind Spot of TDDThe World Outside - The Blind Spot of TDD
The World Outside - The Blind Spot of TDD
 
DevOps Case Studies
DevOps Case StudiesDevOps Case Studies
DevOps Case Studies
 
Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...
Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...
Scaling Gilt: from Monolithic Ruby Application to Distributed Scala Micro-Ser...
 
Metrics-Driven Devops: Delivering High Quality Software Faster!
Metrics-Driven Devops: Delivering High Quality Software Faster! Metrics-Driven Devops: Delivering High Quality Software Faster!
Metrics-Driven Devops: Delivering High Quality Software Faster!
 
Accelerate Application Migration - August 5, 2020
Accelerate Application Migration - August 5, 2020Accelerate Application Migration - August 5, 2020
Accelerate Application Migration - August 5, 2020
 
Migration to the cloud
Migration to the cloudMigration to the cloud
Migration to the cloud
 
Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)
 
Crystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPICrystal clear service interfaces w/ Swagger/OpenAPI
Crystal clear service interfaces w/ Swagger/OpenAPI
 
Jenkins: Portability Testing & Dealing With Limits
Jenkins: Portability Testing & Dealing With LimitsJenkins: Portability Testing & Dealing With Limits
Jenkins: Portability Testing & Dealing With Limits
 
Disruptive Trends in Application Development
Disruptive Trends in Application DevelopmentDisruptive Trends in Application Development
Disruptive Trends in Application Development
 
Software Testing - Online Guide
Software Testing - Online GuideSoftware Testing - Online Guide
Software Testing - Online Guide
 
Neotys PAC - Stijn Schepers
Neotys PAC - Stijn SchepersNeotys PAC - Stijn Schepers
Neotys PAC - Stijn Schepers
 
Business Utility Application
Business Utility ApplicationBusiness Utility Application
Business Utility Application
 
Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)Enterprise Cloud with IBM & Chef (ChefConf 2013)
Enterprise Cloud with IBM & Chef (ChefConf 2013)
 
Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)
 

More from Cloud Study Network

AI and OpenStack for Resilient Infrastructure by Avani Rampersad
AI and OpenStack for Resilient Infrastructure by Avani RampersadAI and OpenStack for Resilient Infrastructure by Avani Rampersad
AI and OpenStack for Resilient Infrastructure by Avani RampersadCloud Study Network
 
OpenInfra Projects Overview by Ildiko Vancsa.pdf
OpenInfra Projects Overview by Ildiko Vancsa.pdfOpenInfra Projects Overview by Ildiko Vancsa.pdf
OpenInfra Projects Overview by Ildiko Vancsa.pdfCloud Study Network
 
Agile Architecture in a Modern Cloud-Native Ecosystem
Agile Architecture in a Modern Cloud-Native EcosystemAgile Architecture in a Modern Cloud-Native Ecosystem
Agile Architecture in a Modern Cloud-Native EcosystemCloud Study Network
 
Networking 101 - Your Personal Community by Franziska Hauck
Networking 101 - Your Personal Community by Franziska HauckNetworking 101 - Your Personal Community by Franziska Hauck
Networking 101 - Your Personal Community by Franziska HauckCloud Study Network
 
From House Keeping to Data Engineering by Jean Joseph
From House Keeping to Data Engineering by Jean JosephFrom House Keeping to Data Engineering by Jean Joseph
From House Keeping to Data Engineering by Jean JosephCloud Study Network
 
Clouds, Certifications, Careers by Dan Sullivan
Clouds, Certifications, Careers by Dan SullivanClouds, Certifications, Careers by Dan Sullivan
Clouds, Certifications, Careers by Dan SullivanCloud Study Network
 
Artifactory Essentials Workshop on August 27, 2020 by JFrog
Artifactory Essentials Workshop on August 27, 2020 by JFrogArtifactory Essentials Workshop on August 27, 2020 by JFrog
Artifactory Essentials Workshop on August 27, 2020 by JFrogCloud Study Network
 

More from Cloud Study Network (9)

AI and OpenStack for Resilient Infrastructure by Avani Rampersad
AI and OpenStack for Resilient Infrastructure by Avani RampersadAI and OpenStack for Resilient Infrastructure by Avani Rampersad
AI and OpenStack for Resilient Infrastructure by Avani Rampersad
 
OpenInfra Projects Overview by Ildiko Vancsa.pdf
OpenInfra Projects Overview by Ildiko Vancsa.pdfOpenInfra Projects Overview by Ildiko Vancsa.pdf
OpenInfra Projects Overview by Ildiko Vancsa.pdf
 
Agile Architecture in a Modern Cloud-Native Ecosystem
Agile Architecture in a Modern Cloud-Native EcosystemAgile Architecture in a Modern Cloud-Native Ecosystem
Agile Architecture in a Modern Cloud-Native Ecosystem
 
Cloud Ambassador Programs
Cloud Ambassador ProgramsCloud Ambassador Programs
Cloud Ambassador Programs
 
Networking 101 - Your Personal Community by Franziska Hauck
Networking 101 - Your Personal Community by Franziska HauckNetworking 101 - Your Personal Community by Franziska Hauck
Networking 101 - Your Personal Community by Franziska Hauck
 
From House Keeping to Data Engineering by Jean Joseph
From House Keeping to Data Engineering by Jean JosephFrom House Keeping to Data Engineering by Jean Joseph
From House Keeping to Data Engineering by Jean Joseph
 
How to become a DevOps Engineer
How to become a DevOps EngineerHow to become a DevOps Engineer
How to become a DevOps Engineer
 
Clouds, Certifications, Careers by Dan Sullivan
Clouds, Certifications, Careers by Dan SullivanClouds, Certifications, Careers by Dan Sullivan
Clouds, Certifications, Careers by Dan Sullivan
 
Artifactory Essentials Workshop on August 27, 2020 by JFrog
Artifactory Essentials Workshop on August 27, 2020 by JFrogArtifactory Essentials Workshop on August 27, 2020 by JFrog
Artifactory Essentials Workshop on August 27, 2020 by JFrog
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Test Strategies for Microservices with Christoph Ebeling

  • 1. Christoph Ebeling – Managing Director April 21, 2022 TESTING MICROSERVICES
  • 2. AGENDA ‣ Quick overview on testing strategies ‣ Evaluating their eligibility for cloud microservices deployments ‣ Sharing two specific strategies for microservice testing
  • 3. COMPARING MODES OF TESTING MANUAL VS. AUTOMATED Regression Documentation Code quality FAST IN THE SHORT RUN FAST IN THE LONG RUN Manual testing can be faster in the short run, however:
  • 4. WHY TESTING SOFTWARE CAN BE CHALLENGING Ø Tooling Ø Slow CI Servers Ø Lack of knowledge about testing framework Ø Too much effort for low ROI Ø Bad software architecture / code is hard to test
  • 5. WHAT IS THE GOAL OF ALL THIS TESTING? DEVELOP TEST DEPLOY
  • 8. EXAMPLE ▸Text class User { int id; public float getMonthlyNetSpendings() { ArrayList<Order> orders = OrderService.findByUserId(this.id); float amount = 0; for (Order order: orders) { amount += order.getAmount(); } return amount; } } Needs Mock Net or Gross?
  • 9. TEST TYPES 1 Fast execution 2 3 4 Unit test Good for complex logic / high cyclomatic complexity Not sufficient to ensure software is working High effort to maintain Integration testing Test the whole application E2E test / Functional Test Enables us to deploy with confidence Hard to cover all edge cases Painful to write and maintain Slow 1 2 3 4 5 What would it look like in a microservice environment?
  • 10. EXAMPLE ▸Text class User { int id; public float getMonthlyNetSpendings() { ArrayList<Order> orders = OrderService.findByUserId(this.id); float amount = 0; for (Order order: orders) { amount += order.getAmount(); } return amount; } } LET’S TAKE A CLOSER LOOK Needs Mock Net or Gross?
  • 11. TEST TYPES 1 Fast execution Unit testing 2 Good for complex logic / high cyclomatic complexity 3 Not sufficient to ensure software is working 4 High effort to maintain Integration testing E2E test / Functional testing Test the whole application 1 Enables us to deploy with confidence 2 Hard to cover all edge cases 3 Painful to write and maintain 4 Slow 5 1 Tests a large part of the application, including interfaces 2 Is still fast enough on modern computers
  • 12. REQUIREMENTS FOR A MICROSERVICE ARCHITECTURE SERVICES ARE LOOSELY COUPLED. CAN BE INDEPENDENTLY DEPLOYED. TEAMS MAY WORK AT DIFFERENT TIMES, DIFFERENT LOCATIONS, NOT ALWAYS ABLE TO COMMUNICATE. 1 2 3
  • 13. ILLUSTRATION OF MICROSERVICE INTEGRATION TESTING SERVICE C SERVICE B SERVICE A SERVICE A TEST Get /api-endpoint-1 Post /api-endpoint-2 New feature needs to get new information from Service C Get /api-endpoint-2 NOT IMPLEMENTED CHANGE CAN’T BE MERGED DEAR TEAM C, WE’VE CREATED A NEW FEATURE BUT CAN’T DEPLOY CAUSE YOU’RE MISSING AN API ENDPOINT. PLEASE CHECKOUT MY BRANCH, THEN RUN MY NEW CONTAINER, DEPLOY MY NEW FANCY MONGO DB, RUN SERVICE TEST A AND MAKE SURE EVERYTHING IS FINE. IT WOULD BE SWEET IF YOU COULD ALSO TEST THE ERRORS FOR ME. PS: PLS DON’T FORGET TO LOAD MY FIXTURES, RUN MIGRATION…OH AND HEY, SOMETIMES SERVICE TEST A TIMES OUT, JUST RERUN IT. IN CASE OF ANY PROBLEMS FEEL FREE TO HIT UP OUR INTERN. TEAM A TEAM C
  • 14. I WANT MY MOCK BACK!!! (But this time we do it better……………I promise!!)
  • 15. WHY WE DIDN’T LIKE MOCKS IN THE FIRST PLACE? Ø The mocked API could have a different interface Ø The mocked API could give different results Ø When the mocked API changes, we won’t notice
  • 16. SERVICE C SERVICE B SERVICE A SERVICE A TEST Post /api-endpoint-2 New feature needs to get new information from Service C CHANGE CAN’T BE MERGED TEAM A TEAM C API MOCK DEAR TEAM C, WE’VE CREATED A NEW FEATURE. I ALREADY TESTED IT WITH A MOCK (IT WORKS LIKE A CHARM) AND ATTACHED YOU THE LATEST SWAGGER FILES AS WELL AS MY PAYLOAD AND EXPECTED JSON. PLS WRITE A UNIT TEST FOR YOUR API, MAKE IT GREEN, AND LET ME KNOW WHEN YOU’RE DONE. UNIT TEST Consumer Driven Contracts
  • 17. RECAP WHAT DO WE KNOW SO FAR ? Ø We covered the business logic of our single services. Ø We know the services and their compatibility. Ø We (hopefully) covered all edge cases that our Devs could think about.
  • 18. WHAT STILL NEEDS TO BE COVERED WHAT DO WE NOT KNOW ? Ø Will it work on scale? Ø Will it work with real user data? Ø Is there anything our automated tests did not consider?
  • 19. SERVICE C (V1) SERVICE B SERVICE A SERVICE A TEST Post /api-endpoint-2 CHANGE CAN’T BE MERGED SERVICE C (V2) Splits traffic SERVICE C Canary deployment with service mesh
  • 20. SERVICE C SERVICE B SERVICE A SERVICE A TEST Post /api-endpoint-2 CHANGE CAN’T BE MERGED Message Broker MESSAGE BROKER
  • 21. SERVICE C (V1) SERVICE B SERVICE A SERVICE A TEST Post /api-endpoint-2 CHANGE CAN’T BE MERGED Canary Deployment with message broker MESSAGE BROKER SERVICE C (V2) Both get 100% of the traffic