SlideShare una empresa de Scribd logo
1 de 29
Testing
Strategies for
Micro-services
Architecture
Ketan Soni
Jesal Mistry
June 2014
2
What is a micro-service?
3
Example
I want to purchase a product
from an e-commerce website
4
Monolithi
c system
MasterCard / VisaLogistics
Cart Catalog
Authentication
Payment
Fulfilment
E-commerce
website
5
Unix philosophy:
Write programs that do one thing and 
do it well.
6
Micro-
Services
system
MasterCard / VisaLogistics
Cart
Service
Payment
Service
Authentication
Service
Fulfilment
Service
Catalog
Service
E-commerce
website
7
Challenges
in testing Distributed system complexity
•  Inter service communication
•  Asynchronous nature
•  Dependency management
Challenges
in testing
8
Testing
Strategies
Top-down
Big Bang
Hybrid / Context Driven
Bottom-up
9
Our
Approach
Bottom-up testing
• Test the domain
• Tests closer to the code
• Integrate Early
• Use Mocks / Stubs
• Focus is on Test Pyramid
• Helps visualize/categorize test
coverage better
10
Test
Pyramid
Unit
Contract
E2E Integration
UI
Consumer
Driven Contract
Manual /
Exploratory
Bottom-up testing
11
Test
Pyramid
Unit
Contract
E2E Integration
UI
Consumer
Driven Contract
Manual /
Exploratory
12
Unit Test
Layer
• Test the domain
• Should focus on the code under test
• Maximum test coverage
13
Unit Test
Layer
Authentication
Service
Payment Service
Catalog Service
Unit tests
- addItem
- removeItem
- verifyCreditCard
Cart Service
Fulfilment
Service
14
Test
Pyramid
Unit
Contract
E2E Integration
UI
Consumer
Driven Contract
Manual /
Exploratory
15
Contract
Test Layer • Test one end-point at a time
• Treat the service as a black box
• These tests are end to end within the bounds of
the service
• Assertion are on response e.g. JSON body
• Stub out the dependencies
Contract
Test Layer
16
Contract
Test Layer
Contract
Test Layer
Contract tests
POST /cart/{:product_id}
HTTP Request
HTTP
Response
JSON …....
Cart Service
Mock
Authentication
Service
Mock
Catalog
Service
Mock
Fulfilment
Service
Mock
Payment
Service
17
Unit
Contract
E2E Integration
UI
Consumer
Driven Contract
Manual /
Exploratory
Test
Pyramid
18
End to End
Integration
Test layer
• Test End to End user journey to make sure that
the business flow works as expected
• These covers interaction of all the available
services
End to End
Integration
Test Layer
19
End to End
Integration
Test layer E2E Integration tests
Cart Service
Place an order
Payment Service
Authentication
Service
Catalog Service
Fulfilment
Service
Verify that the order is placed Mock
Logistics
Mock
Mastercard
End to End
Integration
Test Layer
20
Test
Pyramid
Unit
Contract
E2E Integration
UI
Consumer
Driven Contract
Manual /
Exploratory
21
Consumer
Driven
Contract
Test layer • In case of third-party system, we had tests to
make sure that external systems behave the
way we expect them to.
Consumer
Driven
Contract
Test Layer
22
Consumer
Driven
Contract
Test layer
Consumer Driven
Contract tests
MasterCard / Visa
Service
Consumer
Driven
Contract
Test Layer
Verify Credit Card
HTTP Request
HTTP
Response
Success
23
Test
Pyramid
Unit
Contract
E2E Integration
UI
Consumer
Driven Contract
Manual /
Exploratory
24
UI Test
Layer
• For the UI layer, we wrote tests for the End to
End user journey which also covered the
external 3rd party interactions
• UI tests were minimal
25
UI Test
Layer
User Interface Journey tests
Authentication
Service
Fulfilment Service
Payment Service
Cart Service
As a user
I should be able
to purchase
a mobile from
a website
UI
MasterCard / Visa Logistics
26
Test
Pyramid
Unit
Contract
E2E Integration
UI
Consumer
Driven Contract
Manual /
Exploratory
27
References
• Logging
• Inter - Service effects
• Gracefully handle errors
• Look & Feel
Manual /
Exploratory
28
References
• http://en.wikipedia.org/wiki/Unix
• http://davidmorgantini.blogspot.co.uk/2014/03/microservices-
effective-testing.html
• http://martinfowler.com/articles/microservices.html
• https://github.com/tobyclemson
References
29
Questions
?

Más contenido relacionado

La actualidad más candente

Continuous Integration and Delivery at Shapeways (Matt Boyle)
Continuous Integration and Delivery at Shapeways (Matt Boyle)Continuous Integration and Delivery at Shapeways (Matt Boyle)
Continuous Integration and Delivery at Shapeways (Matt Boyle)
Nordic APIs
 

La actualidad más candente (20)

TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...
TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...
TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...
 
Tips and tricks for Testing Micro-Services
Tips and tricks for Testing Micro-ServicesTips and tricks for Testing Micro-Services
Tips and tricks for Testing Micro-Services
 
TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
TDD for APIs in a Microservice World (extended Version) by Michael Kuehne-Sch...
 
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
Consumer-driven contracts: avoid microservices integration hell! (LondonCD - ...
 
Continuous Integration and Delivery at Shapeways (Matt Boyle)
Continuous Integration and Delivery at Shapeways (Matt Boyle)Continuous Integration and Delivery at Shapeways (Matt Boyle)
Continuous Integration and Delivery at Shapeways (Matt Boyle)
 
A better approach for testing microservices - introducing test kits in practice
A better approach for testing microservices - introducing test kits in practiceA better approach for testing microservices - introducing test kits in practice
A better approach for testing microservices - introducing test kits in practice
 
API Design Collaboration
API Design CollaborationAPI Design Collaboration
API Design Collaboration
 
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
 
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
 
How to Choose an API Automation Tool for a Distributed Cloud-based App: To...
How to Choose an API Automation Tool for a Distributed Cloud-based App: To...How to Choose an API Automation Tool for a Distributed Cloud-based App: To...
How to Choose an API Automation Tool for a Distributed Cloud-based App: To...
 
Automate across Platform, OS, Technologies with TaaS
Automate across Platform, OS, Technologies with TaaSAutomate across Platform, OS, Technologies with TaaS
Automate across Platform, OS, Technologies with TaaS
 
Understanding and Executing on API Developer Experience
Understanding and Executing on API Developer ExperienceUnderstanding and Executing on API Developer Experience
Understanding and Executing on API Developer Experience
 
Mule soft mcia-level-1 Dumps
Mule soft mcia-level-1 DumpsMule soft mcia-level-1 Dumps
Mule soft mcia-level-1 Dumps
 
Effective API Lifecycle Management
Effective API Lifecycle Management Effective API Lifecycle Management
Effective API Lifecycle Management
 
Deep Dive on CI/CD NYC Meet Up Group
Deep Dive on CI/CD NYC Meet Up GroupDeep Dive on CI/CD NYC Meet Up Group
Deep Dive on CI/CD NYC Meet Up Group
 
Advanced Automation in Your API Lifecycle
Advanced Automation in Your API Lifecycle Advanced Automation in Your API Lifecycle
Advanced Automation in Your API Lifecycle
 
Continuous Testing- A Key Ingredient for Success in Agile & DevOps
Continuous Testing- A Key Ingredient for Success in Agile & DevOpsContinuous Testing- A Key Ingredient for Success in Agile & DevOps
Continuous Testing- A Key Ingredient for Success in Agile & DevOps
 
[Workshop] Managing the API lifecycle with Open Source Technologies
[Workshop] Managing the API lifecycle with Open Source Technologies[Workshop] Managing the API lifecycle with Open Source Technologies
[Workshop] Managing the API lifecycle with Open Source Technologies
 
Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1Introducing OpenAPI Version 3.1
Introducing OpenAPI Version 3.1
 
ESB Testing
ESB TestingESB Testing
ESB Testing
 

Similar a Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks

Similar a Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks (20)

Testing Microservices
Testing MicroservicesTesting Microservices
Testing Microservices
 
Wading through treacle? Escape the integration syrup with contract tests
Wading through treacle? Escape the integration syrup with contract testsWading through treacle? Escape the integration syrup with contract tests
Wading through treacle? Escape the integration syrup with contract tests
 
Continuous Integration and Continuous Delivery to Facilitate Web Service Testing
Continuous Integration and Continuous Delivery to Facilitate Web Service TestingContinuous Integration and Continuous Delivery to Facilitate Web Service Testing
Continuous Integration and Continuous Delivery to Facilitate Web Service Testing
 
Experitest & Wipro Co-Webinar
Experitest & Wipro Co-Webinar Experitest & Wipro Co-Webinar
Experitest & Wipro Co-Webinar
 
Semantic Web Process Lifecycle: Role of Semantics in Annotation, Discovery, C...
Semantic Web Process Lifecycle: Role of Semantics in Annotation, Discovery, C...Semantic Web Process Lifecycle: Role of Semantics in Annotation, Discovery, C...
Semantic Web Process Lifecycle: Role of Semantics in Annotation, Discovery, C...
 
Semantic Web Process Lifecycle:
Semantic Web Process Lifecycle: Semantic Web Process Lifecycle:
Semantic Web Process Lifecycle:
 
Automating your EdI Testing in Healthcare | QualiTest Group
Automating your EdI Testing in Healthcare | QualiTest GroupAutomating your EdI Testing in Healthcare | QualiTest Group
Automating your EdI Testing in Healthcare | QualiTest Group
 
Resume_Exp
Resume_ExpResume_Exp
Resume_Exp
 
BDD Approach with Karate Framework in Service Tests
BDD Approach with Karate Framework in Service TestsBDD Approach with Karate Framework in Service Tests
BDD Approach with Karate Framework in Service Tests
 
A long way from Monolith to Service Isolated Architecture #MM19NL
A long way from Monolith to Service Isolated Architecture #MM19NLA long way from Monolith to Service Isolated Architecture #MM19NL
A long way from Monolith to Service Isolated Architecture #MM19NL
 
e-Procurement in Indian Government
e-Procurement in Indian Governmente-Procurement in Indian Government
e-Procurement in Indian Government
 
Madhav_Resume
Madhav_ResumeMadhav_Resume
Madhav_Resume
 
Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...
Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...
Best Practices for Troubleshooting Slow Citrix Logon and Ensuring Excellent U...
 
Decision as a Service (DaaS) the DMN platform revolution
Decision as a Service (DaaS) the DMN platform revolutionDecision as a Service (DaaS) the DMN platform revolution
Decision as a Service (DaaS) the DMN platform revolution
 
Rethinking Test Automation: The Case for Moving Beyond the User Interface
Rethinking Test Automation: The Case for Moving Beyond the User InterfaceRethinking Test Automation: The Case for Moving Beyond the User Interface
Rethinking Test Automation: The Case for Moving Beyond the User Interface
 
Managing Mobile App Performance Through Geo-Performance Visibility
Managing Mobile App Performance Through Geo-Performance VisibilityManaging Mobile App Performance Through Geo-Performance Visibility
Managing Mobile App Performance Through Geo-Performance Visibility
 
SACHIN THAKARE
SACHIN THAKARESACHIN THAKARE
SACHIN THAKARE
 
Serverless microservices: Test smarter, not harder
Serverless microservices: Test smarter, not harderServerless microservices: Test smarter, not harder
Serverless microservices: Test smarter, not harder
 
Startup InsurTech Award - Galileo Platforms
Startup InsurTech Award - Galileo PlatformsStartup InsurTech Award - Galileo Platforms
Startup InsurTech Award - Galileo Platforms
 
Whitepaper : Testing Micro Services Part I & Part 2
Whitepaper : Testing Micro Services Part I & Part 2Whitepaper : Testing Micro Services Part I & Part 2
Whitepaper : Testing Micro Services Part I & Part 2
 

Más de Thoughtworks

Más de Thoughtworks (20)

Design System as a Product
Design System as a ProductDesign System as a Product
Design System as a Product
 
Designers, Developers & Dogs
Designers, Developers & DogsDesigners, Developers & Dogs
Designers, Developers & Dogs
 
Cloud-first for fast innovation
Cloud-first for fast innovationCloud-first for fast innovation
Cloud-first for fast innovation
 
More impact with flexible teams
More impact with flexible teamsMore impact with flexible teams
More impact with flexible teams
 
Culture of Innovation
Culture of InnovationCulture of Innovation
Culture of Innovation
 
Dual-Track Agile
Dual-Track AgileDual-Track Agile
Dual-Track Agile
 
Developer Experience
Developer ExperienceDeveloper Experience
Developer Experience
 
When we design together
When we design togetherWhen we design together
When we design together
 
Hardware is hard(er)
Hardware is hard(er)Hardware is hard(er)
Hardware is hard(er)
 
Customer-centric innovation enabled by cloud
 Customer-centric innovation enabled by cloud Customer-centric innovation enabled by cloud
Customer-centric innovation enabled by cloud
 
Amazon's Culture of Innovation
Amazon's Culture of InnovationAmazon's Culture of Innovation
Amazon's Culture of Innovation
 
When in doubt, go live
When in doubt, go liveWhen in doubt, go live
When in doubt, go live
 
Don't cross the Rubicon
Don't cross the RubiconDon't cross the Rubicon
Don't cross the Rubicon
 
Error handling
Error handlingError handling
Error handling
 
Your test coverage is a lie!
Your test coverage is a lie!Your test coverage is a lie!
Your test coverage is a lie!
 
Docker container security
Docker container securityDocker container security
Docker container security
 
Redefining the unit
Redefining the unitRedefining the unit
Redefining the unit
 
Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22Technology Radar Webinar UK - Vol. 22
Technology Radar Webinar UK - Vol. 22
 
A Tribute to Turing
A Tribute to TuringA Tribute to Turing
A Tribute to Turing
 
Rsa maths worked out
Rsa maths worked outRsa maths worked out
Rsa maths worked out
 

Último

Último (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Testing strategies for micro services - Ketan Soni, Jesal Mistry, ThoughtWorks

Notas del editor

  1. Brief Intro There has been a shift in service based architectures over the last few years towards smaller, more focussed "micro" services. There are many benefits with this approach such as the ability to independently deploy, scale and maintain each component.  Our team has spent the last two years building and deploying more than 10 micro services into production, and we plan to create a few more. Here we would like to discuss a number of approaches and testing strategies for managing the testing of independently deployable components.
  2. Ask the audience
  3. A system built using micro-services is a system that is built up of small, lightweight services, where each performs a single function. The services are arranged in independently deployable groups and communicate with each other via a well defined interface and work together to provide business value.
  4. - as good as having different teams, working on different services
  5. - top down - having UI test - brittleness - high maintenance - slow feedback - big bang - testing after the fact (app is ready & done) - hybrid/context - mix of approaches - bottom up
  6. The goal of these tests is to execute as much of the application code as possible as quickly as possible. The basic idea is to run up all your services in memory and connect them via in memory http pipes.