SlideShare a Scribd company logo
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 Development
CA 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 Development
CA Technologies
 
Performance Testing
Performance Testing Performance Testing
Performance Testing
GeetikaVerma16
 
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
CA 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 TDD
Amit Anafy
 
DevOps Case Studies
DevOps Case StudiesDevOps Case Studies
DevOps Case Studies
WhiteHedge Technologies Inc.
 
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, 2020
VMware Tanzu
 
Migration to the cloud
Migration to the cloudMigration to the cloud
Migration to the cloud
EPAM 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/OpenAPI
Scott Triglia
 
Jenkins: Portability Testing & Dealing With Limits
Jenkins: Portability Testing & Dealing With LimitsJenkins: Portability Testing & Dealing With Limits
Jenkins: Portability Testing & Dealing With Limits
Clemens Scholz
 
Disruptive Trends in Application Development
Disruptive Trends in Application DevelopmentDisruptive Trends in Application Development
Disruptive Trends in Application Development
WaveMaker, Inc.
 
Software Testing - Online Guide
Software Testing - Online GuideSoftware Testing - Online Guide
Software Testing - Online Guide
bigspire
 
Neotys PAC - Stijn Schepers
Neotys PAC - Stijn SchepersNeotys PAC - Stijn Schepers
Neotys PAC - Stijn Schepers
Neotys_Partner
 
Business Utility Application
Business Utility ApplicationBusiness Utility Application
Business Utility Application
IRJET 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 Rampersad
Cloud 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.pdf
Cloud 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 Ecosystem
Cloud Study Network
 
Cloud Ambassador Programs
Cloud Ambassador ProgramsCloud Ambassador Programs
Cloud Ambassador Programs
Cloud 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 Hauck
Cloud 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 Joseph
Cloud Study Network
 
How to become a DevOps Engineer
How to become a DevOps EngineerHow to become a DevOps Engineer
How to become a DevOps Engineer
Cloud Study Network
 
Clouds, Certifications, Careers by Dan Sullivan
Clouds, Certifications, Careers by Dan SullivanClouds, Certifications, Careers by Dan Sullivan
Clouds, Certifications, Careers by Dan Sullivan
Cloud 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 JFrog
Cloud 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

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 

Recently uploaded (20)

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 

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