Component Tests for Spring Cloud Microservices

Introduction

The shift towards microservices has a direct impact on the testing strategies applied and has introduced a number of complexities that need to be addressed. In fact, microservices require additional levels of testing since we have to deal with multiple independently deployable components.

An excellent explanation of these concepts and the various levels of microservices testing is given by Martin Fowler in his Testing Strategies in a Microservice Architecture presentation. Let's have a look at the revised "test pyramid" from this presentation:

Kotlin Wiremock

WireMock is a popular library for stubbing web services. It runs an HTTP server that acts as an actual web service. We just set up expectations and run the server.

In this tutorial, we will present the kotlin-wiremock library that provides a nice domain-specific language for stubbing WireMock expectations.

Mule 4 WireMock Module

In this post, we'll talk about the value of HTTP test doubles in the context of integration tests and introduce the WireMock module to use in Mule 4.

Integration Tests and WireMock

When writing integration software for distributed systems the most critical part to test is the interaction between those systems. Obviously, this makes integration tests vital. Traditionally, we would test against live systems, but having a local instance of an upstream system or a dedicated test instance can be expensive and/or difficult to coordinate its state between tests.            

Instead, we can opt to verify the interactions against test doubles, also known as narrow integration tests. WireMock is a pretty popular HTTP server test double that allows us to configure stubbed responses for particular requests, as well as verifying that the requests it received match what we expect the system under test to have made.

Building Mancala Game in Microservices Using Spring Boot (Part 1: Solution Architecture)

Make a Mancala game like this! 


Nowadays with the popularity of Microservices, when we talk about scalable application development, we inevitably think of composing the application into highly decoupled microservices which can be scaled up independently according to the customers' needs and yet can be managed through various available industry-standard tools such as Docker-compose, Kubernetes, Istio, Linkerd, etc.