Photo by Liam Truong on Unsplash

Why unit testing is not enough when it comes to microservices

Wise men say that the whole is greater than the sum of its parts. In a microservice architecture, we could be tempted to unit testing the single services, forgetting these are just parts of the system.

Mariano Calandra
The Startup
Published in
10 min readJan 2, 2020

--

With good reason, unit tests are seen as a guiding light by every good developer. As the name suggests, this type of test involves just a unit of the overall codebase, without any external dependencies like databases, HTTP calls, queues, topics or something like that. This characteristic makes unit testing deterministic and, above all, fast; so we could run an entire suite of thousands of tests in a bunch of seconds.

Back in the days of big fat monolithic projects, a good suite of unit tests may validate the entire system right after a refactoring work.

Today, with the rise of microservices architectures, this is simply undoable! What we used to call the system, in fact, is now spread into hundreds or thousands of tiny little projects, completely unaware one another.

For this reason, unit testing is not enough when it comes to testing microservices oriented architectures!

Framing the context

--

--

Mariano Calandra
The Startup

Mariano daily helps companies succeed using cloud and microservices. • AWS Authorized Instructor • AWS Community Builder • goto.calandra.me/support