Over 10 years we help companies reach their financial and branding goals. Engitech is a values-driven technology agency dedicated.



411 University St, Seattle, USA


+1 -800-456-478-23


Testing on Microservices

In this blogs, you will learn the testing types and tools when it comes to testing on Microservices. Today most of the BIGs such as Netflix, Amazon, Uber have moved towards microservice, this makes microservice testing more imperative.

Q1. What are microservices?

Microservices are an architectural style that develops a single application as a set of small services. Each service runs in its own process. The services communicate with clients, and often each other, using lightweight protocols, often over messaging or HTTP.

Each service is defined by its characteristics some of which are:

  • Running in its process.
  • Communicating with a lightweight mechanism often with an HTTP resource API.
  • Independently deployable by a fully automated machinery.
  • Using different programming languages/technologies/DB.
  • Is using different data storage technologies.

Q2. How Are Microservices Different to SOA

  • Service-oriented architecture(SOA): an architectural pattern in computer software design in which application components provide services to other components via a communications protocol, typically over a network.
  • Microservices: a software architecture style in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs.
  1. The microservice architectural styles involve developing single applications that can work together as a suite of small services, each running in its individual process and communicating with lightweight mechanisms such as an HTTP resource API.
  2. These services require bare minimum centralized management, use different data storage technologies, and can be written in different programming languages.
  3. Microservices characteristics:
  • Organized around business capability,
  • Automated deployment,
  • Intelligence in the endpoints rather than in service bus,
  • The decentralized control of languages and data.

Q3. How to test Microservices?

Microservices Testing Types

When it comes to microservices testing, the more coarse-grained a test is, the more brittle and time-consuming it becomes to write, execute, and maintain it.

It is explained precisely by Mike Cohn’s test pyramid

1. Unit Testing for Microservices

A unit test focuses on the smallest part of a testable software to ascertain whether that component works as it should

Martin Fowler breaks unit testing down into two categories:

  1. Sociable unit testing: This unit testing method tests the behavior of modules by observing changes in their state.
  2. Solitary unit testing: This method focuses on the interactions and collaborations between an object and its dependencies, which are replaced by test doubles.

2. Microservice Integration testing

Testing the communication paths and interactions between components to detect issues.

The integration test collects microservices together to verify that they collaborate as intended to achieve some larger piece of business logic.

3. Microservice component testing

A component or microservice is a well-defined coherent and independently replaceable part of a larger system. Once we execute unit tests of all the functions within microservices, it’s time to test the microservice itself in isolation.

To test a single microservice in isolation, we need to mock the other microservices.

4. Microservice End to End testing

It involves testing every moving part of the microservice, ensuring that it can achieve the goals you built it for.

It involved

  1. Ensuring if I was on a correct code branch
  2. The latest code from the branch should be pulled down.
  3. Even dependencies, ensure they were up to date.
  4. Run new database migration
  5. And finally, start the service.

Microservices Testing Tools

– Goreplay is an open-source network monitoring tool that records your live traffic. This tool can be used for capturing and replaying live HTTP traffic into your microservices test environment.

– Mountebank is an open-source tool that provides cross-platform, multi-platform test doubles over the wire. You can simply replace real dependencies with Mountebank, and test like you’d do with traditional stubs and mocks.

– VCR helps you in recording your test suite’s HTTP interactions that can be played later during future tests for fast, accurate, and reliable tests.

– Wilma is a service virtualization tool with the combined capability of Service Stub and a HTTP/HTTPS Transparent Proxy. It is easily expandable via plug-ins and can be configured on-the-fly.

– Hikaku– This is a library that helps you in making sure that the implementation of REST-API meets its specifications.

– Mitmproxy– It is a free and open-source interactive HTTPS proxy that can be used for debugging, testing, privacy measurements, and penetration testing.

– Wiremock is a simulator for HTTP-based APIs. Unlike general purpose mocking tools, it works by creating an actual HTTP server that your code under test can connect to as it would a real web service.

The challenges of testing microservices

  • Availability: Since different teams may be managing their own microservices, securing the availability of a microservice (or, worse yet, trying to find a time when all microservices are available at once), is tough.
  • Fragmented and holistic testing: Microservices are built to work alone, and together with other loosely coupled services. That means developers need to test every component in isolation, as well as testing everything together.
  • Knowledge gaps: Particularly with integration testing (which we will address later in this article), whoever conducts the tests will need to have a strong understanding of each service in order to write test cases effectively.

Author –
Tiny Ekanayake
QA Engineer

Leave a comment

Your email address will not be published. Required fields are marked *