SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
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

Contenu connexe

Similaire à 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
 

Similaire à 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)
 

Plus de 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
 

Plus de 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
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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...apidays
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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 WorkerThousandEyes
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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 DevelopmentsTrustArc
 

Dernier (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 

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