SlideShare a Scribd company logo
White Paper © 2016 Newt Global Consulting, LLC
CONTINUOUS INTEGRATION / CONTINUOUS DELIVERY
WHITE PAPER
TESTING MICRO SERVICES PART I OF II
Testing Micro Services is an area that cannot be avoided or procrastinated to any point of time. Each
services’ build before it reaches the deployment stage must be ensured that it passes the test criteria
defined by the project team. While the Project team / Organization focusses on Designing and Developing
Applications using Micro Services, it is also equally important to design Testing Strategies to test those
Micro Services. A combination of testing methods along with tools and frameworks that can provide
support at every layer of testing is key. We may not be able stick to the traditional model of testing, as in
an agile environment changes are very dynamic and with a micro service, we would have to deep dive
into each layer to make sure there is not a hit in the production environment.
White Paper © 2016 Newt Global Consulting, LLC Page 2 of 5
INTRODUCTION
The independent nature of Micro Services possesses significant challenges to the Testing team. Picking
the right tools that are inclined to test the Web API, SDK’s that are built around SOA becomes a necessity
factor in order to automate the Testing process. The Test pyramid gets a little wider and deeper with
Integration Testing, Component Testing and Contract Testing coming into the framework above Unit
Testing. A bottom-up approach to testing improves stability of the micro services as they are developed.
It is also very essential to remain light weight while we are implementing the various tests to test a service,
at the same time make sure that there is a coverage to each layer and layers of service.
Monolithic Micro Services
Fig.: Testing Micro Services
Unit Test Unit TestUnit Test Unit Test
Contract Testing
Contract Testing
Component Testing
Component Testing
REST over HTTPS
White Paper © 2016 Newt Global Consulting, LLC Page 3 of 5
UNIT TESTING
Any function has to be tested at the unit level first, by testing the code written by the Developers for a
particular service. Unit Testing is done usually at class level by testing a small piece of behavior and make
sure the code works correctly at the lowest level. Unit Testing focusses on small test suite by testing the
behavior of modules. Test Doubles looks the interactions and collaborations between an object and its
dependencies.
In a micro service, unit tests are most useful in the service layer, where they can verify business logic
under controlled circumstances against conditions provided by mock collaborators. They are also useful
in domain logic, resources, repositories, and adapters for testing exceptional conditions. Unit Tests have
to be executed frequently, with each build. To follow an automated process, we can configure Unit Tests
on a Continuous Integration server (say Jenkins) that constantly monitors for changes in the code.
COMPONENT TESTING
In micro services, components are services that tests a portion of the system. Tests written at this
granularity makes it possible to thoroughly acceptance the test behavior. This is done by creating an
internal interface inside the unit for testing before reaching the production. Component Testing is also
otherwise called ‘Functional Testing’, where the services test to verify integration of all components is
functionally correct that do not require external dependencies. Testing is done in isolation by using mock
components or by creating a Test Service on the same server and test the complexity contained within
that micro service, but make sure that that final application code reaches the production and not the test
code.
The scope is limited to a single component and Testing is done using the same technology that incoming
requests would use, restful api for example. This method also thoroughly tests the network calls for that
particular service and the results are quick, so that developers can gain confidence that whatever changes
they have made, does not affect any other service or component. Test doubles can be configured to isolate
the micro service from external service that allows error conditions tested in a controlled environment
and repeatable manner. Mock implementations can be avoided by testing against external devices with
recorded responses. Though this practice is more realistic and traditional, there is a complexity involved
in order to maintain the recorded responses for each service.
White Paper © 2016 Newt Global Consulting, LLC Page 4 of 5
CONTRACT TESTING
Test for agreed set of input and output attributes is set to be defined as Contract Testing. In other words,
the boundary of an external service is verified that it meets the contract expected by consuming the
service. Contract Testing makes sure that any additions shouldn’t break the existing functionality of the
service, even as the service changes overtime. The production team are well aware of the impact of the
changes on their consumers by looking at the test suites written by the testing team that are well
packaged and runnable in build pipeline for producing services. In Micro Service there is a contract
involved with each of the service that interacts with the Producer.
Mock frameworks can be used to fake responses from external services that gives the possibility to test
services in an isolated environment without relying on external services. They can also be used as
Integration Contract Testing to validate the parameters that are passed to the external service are
integrated to receive the correct request. When there are different teams that run tests for different
services, which means essentially each team have their own contract testing to be executed. A service
contract can be defined by the maintainer by looking at the different contract tests. Service contract can
be used to manage changes as in when they are introduced.
Scenario:
Consider a service that exposes a resource with three fields, an identifier, a location and an order.
White Paper © 2016 Newt Global Consulting, LLC Page 5 of 5
This service is adopted by three different consumers coupled to different parts of the resource. Consumer
A couples to only the identifier and location field. This does not make any claim regarding the order field.
Whereas Consumer B couples to the identifier and order fields, and does not make assert to the location
field. Consumer C requires all three fields and has a contract test suite that affirms they all are present
and communicating.
When a new consumer adopts the API but requires both location and address, the maintainers can choose
to deprecate the location field and introduce another field containing an object with location components.
The maintainers can check the Service contract, remove the old location field and see which contract test
fail. In this case, Consumer A and C would have to be notified on the change. Post migration, the
deprecated field can be removed from Consumer A and C. For this process to be effective, the service
contract need to be updated on a regular basis with fields that are not important.
This is an example of how an API can be changed over a period of time without breaking the contract of
the consumers. To test this efficiency is known to be Contract Testing. These tests can be automated with
a variety of contract testing tools.

More Related Content

PPTX
Micro Service automation by Srijit Jain
PDF
Software testing services growth report oct 11
PPTX
Software Testing Services | Best software testing consulting companies
PDF
Softcrylic_CIO_Review
PPTX
SGS Technologie Software Testing Services
PDF
Testing Services - Software Quality Assurance
PPTX
Testing microservices, contract testing
PDF
Continuous integration testing for automation needs and quality of the releases
Micro Service automation by Srijit Jain
Software testing services growth report oct 11
Software Testing Services | Best software testing consulting companies
Softcrylic_CIO_Review
SGS Technologie Software Testing Services
Testing Services - Software Quality Assurance
Testing microservices, contract testing
Continuous integration testing for automation needs and quality of the releases

What's hot (19)

PDF
Cigniti Independent Software Testing Services
PDF
6 Things To Consider When Selecting Mobile Testing Tools?
PPT
Zephyr Announces New Release of On-Demand Test Management Platform
PDF
QA Automation testing - Cloud deployed workflow application
PDF
Extreme Automation Enables DirecTV to ”Shift Left” API Testing
PPTX
Leveraging Jama Connect Effectively in a Multi-Tool Environment
PPTX
Software testing
PPTX
Reducing Cost and Risk of Effective Compliance in Multi-Tool Ecosystem
PPTX
Testing for a Great App and Web Experience | QualiTest Group
PDF
10 Software Testing Trends 2019
PDF
47 b 9e3-b98
PDF
TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...
PDF
Testing Microservices
PDF
Industrialization of testing
PPTX
What is web testing in details
PPTX
Software Testing Services Manual
PDF
Banking App Testing - To Evaluate Performance
PPT
isoTracker Solutions Ltd launches an upgrade to the Complaints module
PDF
Integration testing with PACT
Cigniti Independent Software Testing Services
6 Things To Consider When Selecting Mobile Testing Tools?
Zephyr Announces New Release of On-Demand Test Management Platform
QA Automation testing - Cloud deployed workflow application
Extreme Automation Enables DirecTV to ”Shift Left” API Testing
Leveraging Jama Connect Effectively in a Multi-Tool Environment
Software testing
Reducing Cost and Risk of Effective Compliance in Multi-Tool Ecosystem
Testing for a Great App and Web Experience | QualiTest Group
10 Software Testing Trends 2019
47 b 9e3-b98
TDD for APIs in a Microservice World (Short Version) by Michael Kuehne-Schlin...
Testing Microservices
Industrialization of testing
What is web testing in details
Software Testing Services Manual
Banking App Testing - To Evaluate Performance
isoTracker Solutions Ltd launches an upgrade to the Complaints module
Integration testing with PACT
Ad

Viewers also liked (18)

PDF
Whitepaper : Event Driven Micro Services
PPTX
PLAN DE GESTION TICS IE JOSE AGUSTIN MACKENCIE
PDF
Curriculumdoc
PDF
Whitepaper : Building an Efficient Microservices Architecture
PDF
Ejercicio 3 tema 8
PDF
Tema 5 ejercicio 1
PPTX
Presentación1
PDF
Ejercicio 5
PDF
Trabajo fraudes en internet
DOCX
PPTX
PLAN DE GESTION TICS IE JOSE AGUSTIN MACKENCIE
PDF
Whitepaper : Microservices In or Out
PDF
PPTX
Convergencia Electronica
PPTX
Baudrillard and Zoonen
PDF
Ejercicio 4
PPTX
Quarks
PPTX
з досвіду роботи вчителя.
Whitepaper : Event Driven Micro Services
PLAN DE GESTION TICS IE JOSE AGUSTIN MACKENCIE
Curriculumdoc
Whitepaper : Building an Efficient Microservices Architecture
Ejercicio 3 tema 8
Tema 5 ejercicio 1
Presentación1
Ejercicio 5
Trabajo fraudes en internet
PLAN DE GESTION TICS IE JOSE AGUSTIN MACKENCIE
Whitepaper : Microservices In or Out
Convergencia Electronica
Baudrillard and Zoonen
Ejercicio 4
Quarks
з досвіду роботи вчителя.
Ad

Similar to Whitepaper : Testing Micro Services Part I & Part 2 (20)

PDF
Testing Microservices
PPTX
Testing.pptx
PDF
ugc carelist.pdf
PDF
ugc journal.pdf
PDF
scopus indexed journals list.pdf
PDF
journal of engineering and applied science.pdf
PDF
journal of engineering and applied science.pdf
PDF
research journal publication
PDF
research journal publication
PDF
ijlbpr_64ab991977359.pdf
PDF
ugc journal.pdf
PDF
Continuous Testing of Service-Oriented Applications Using Service Virtualization
PDF
M017258892
PDF
Navigating the World of Microservices Testing.pdf
PDF
Test Automation in a Microservices Architecture.pdf
PDF
Enhancing Serverless Architecture with Cloud-Native Testing.pdf
PDF
Enhancing Serverless Architecture with Cloud-Native Testing.pdf
PDF
Ensuring Effective Performance Testing in Web Applications.pdf
PDF
Some practical considerations and a
PDF
A Comprehensive Guide to Boosting ROI through Secured Cloud-based Testing.pdf
Testing Microservices
Testing.pptx
ugc carelist.pdf
ugc journal.pdf
scopus indexed journals list.pdf
journal of engineering and applied science.pdf
journal of engineering and applied science.pdf
research journal publication
research journal publication
ijlbpr_64ab991977359.pdf
ugc journal.pdf
Continuous Testing of Service-Oriented Applications Using Service Virtualization
M017258892
Navigating the World of Microservices Testing.pdf
Test Automation in a Microservices Architecture.pdf
Enhancing Serverless Architecture with Cloud-Native Testing.pdf
Enhancing Serverless Architecture with Cloud-Native Testing.pdf
Ensuring Effective Performance Testing in Web Applications.pdf
Some practical considerations and a
A Comprehensive Guide to Boosting ROI through Secured Cloud-based Testing.pdf

More from Newt Global Consulting LLC (6)

PPTX
Why Cloud and DevOps are interlinked?
PPTX
Webinar : Microservices and Containerization
PPTX
Webinar : Docker in Production
PPTX
Webinar Docker Tri Series
PPTX
Demystify DevOps
PPTX
Webinar : SVN to GIT Migration
Why Cloud and DevOps are interlinked?
Webinar : Microservices and Containerization
Webinar : Docker in Production
Webinar Docker Tri Series
Demystify DevOps
Webinar : SVN to GIT Migration

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Encapsulation theory and applications.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Machine Learning_overview_presentation.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Cloud computing and distributed systems.
PPTX
sap open course for s4hana steps from ECC to s4
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Programs and apps: productivity, graphics, security and other tools
Encapsulation theory and applications.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)
Machine Learning_overview_presentation.pptx
Assigned Numbers - 2025 - Bluetooth® Document
NewMind AI Weekly Chronicles - August'25-Week II
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Cloud computing and distributed systems.
sap open course for s4hana steps from ECC to s4
The AUB Centre for AI in Media Proposal.docx
The Rise and Fall of 3GPP – Time for a Sabbatical?
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Whitepaper : Testing Micro Services Part I & Part 2

  • 1. White Paper © 2016 Newt Global Consulting, LLC CONTINUOUS INTEGRATION / CONTINUOUS DELIVERY WHITE PAPER TESTING MICRO SERVICES PART I OF II Testing Micro Services is an area that cannot be avoided or procrastinated to any point of time. Each services’ build before it reaches the deployment stage must be ensured that it passes the test criteria defined by the project team. While the Project team / Organization focusses on Designing and Developing Applications using Micro Services, it is also equally important to design Testing Strategies to test those Micro Services. A combination of testing methods along with tools and frameworks that can provide support at every layer of testing is key. We may not be able stick to the traditional model of testing, as in an agile environment changes are very dynamic and with a micro service, we would have to deep dive into each layer to make sure there is not a hit in the production environment.
  • 2. White Paper © 2016 Newt Global Consulting, LLC Page 2 of 5 INTRODUCTION The independent nature of Micro Services possesses significant challenges to the Testing team. Picking the right tools that are inclined to test the Web API, SDK’s that are built around SOA becomes a necessity factor in order to automate the Testing process. The Test pyramid gets a little wider and deeper with Integration Testing, Component Testing and Contract Testing coming into the framework above Unit Testing. A bottom-up approach to testing improves stability of the micro services as they are developed. It is also very essential to remain light weight while we are implementing the various tests to test a service, at the same time make sure that there is a coverage to each layer and layers of service. Monolithic Micro Services Fig.: Testing Micro Services Unit Test Unit TestUnit Test Unit Test Contract Testing Contract Testing Component Testing Component Testing REST over HTTPS
  • 3. White Paper © 2016 Newt Global Consulting, LLC Page 3 of 5 UNIT TESTING Any function has to be tested at the unit level first, by testing the code written by the Developers for a particular service. Unit Testing is done usually at class level by testing a small piece of behavior and make sure the code works correctly at the lowest level. Unit Testing focusses on small test suite by testing the behavior of modules. Test Doubles looks the interactions and collaborations between an object and its dependencies. In a micro service, unit tests are most useful in the service layer, where they can verify business logic under controlled circumstances against conditions provided by mock collaborators. They are also useful in domain logic, resources, repositories, and adapters for testing exceptional conditions. Unit Tests have to be executed frequently, with each build. To follow an automated process, we can configure Unit Tests on a Continuous Integration server (say Jenkins) that constantly monitors for changes in the code. COMPONENT TESTING In micro services, components are services that tests a portion of the system. Tests written at this granularity makes it possible to thoroughly acceptance the test behavior. This is done by creating an internal interface inside the unit for testing before reaching the production. Component Testing is also otherwise called ‘Functional Testing’, where the services test to verify integration of all components is functionally correct that do not require external dependencies. Testing is done in isolation by using mock components or by creating a Test Service on the same server and test the complexity contained within that micro service, but make sure that that final application code reaches the production and not the test code. The scope is limited to a single component and Testing is done using the same technology that incoming requests would use, restful api for example. This method also thoroughly tests the network calls for that particular service and the results are quick, so that developers can gain confidence that whatever changes they have made, does not affect any other service or component. Test doubles can be configured to isolate the micro service from external service that allows error conditions tested in a controlled environment and repeatable manner. Mock implementations can be avoided by testing against external devices with recorded responses. Though this practice is more realistic and traditional, there is a complexity involved in order to maintain the recorded responses for each service.
  • 4. White Paper © 2016 Newt Global Consulting, LLC Page 4 of 5 CONTRACT TESTING Test for agreed set of input and output attributes is set to be defined as Contract Testing. In other words, the boundary of an external service is verified that it meets the contract expected by consuming the service. Contract Testing makes sure that any additions shouldn’t break the existing functionality of the service, even as the service changes overtime. The production team are well aware of the impact of the changes on their consumers by looking at the test suites written by the testing team that are well packaged and runnable in build pipeline for producing services. In Micro Service there is a contract involved with each of the service that interacts with the Producer. Mock frameworks can be used to fake responses from external services that gives the possibility to test services in an isolated environment without relying on external services. They can also be used as Integration Contract Testing to validate the parameters that are passed to the external service are integrated to receive the correct request. When there are different teams that run tests for different services, which means essentially each team have their own contract testing to be executed. A service contract can be defined by the maintainer by looking at the different contract tests. Service contract can be used to manage changes as in when they are introduced. Scenario: Consider a service that exposes a resource with three fields, an identifier, a location and an order.
  • 5. White Paper © 2016 Newt Global Consulting, LLC Page 5 of 5 This service is adopted by three different consumers coupled to different parts of the resource. Consumer A couples to only the identifier and location field. This does not make any claim regarding the order field. Whereas Consumer B couples to the identifier and order fields, and does not make assert to the location field. Consumer C requires all three fields and has a contract test suite that affirms they all are present and communicating. When a new consumer adopts the API but requires both location and address, the maintainers can choose to deprecate the location field and introduce another field containing an object with location components. The maintainers can check the Service contract, remove the old location field and see which contract test fail. In this case, Consumer A and C would have to be notified on the change. Post migration, the deprecated field can be removed from Consumer A and C. For this process to be effective, the service contract need to be updated on a regular basis with fields that are not important. This is an example of how an API can be changed over a period of time without breaking the contract of the consumers. To test this efficiency is known to be Contract Testing. These tests can be automated with a variety of contract testing tools.