As with any technology, the microservices have their strengths and weaknesses, and the right architecture and usage can help here. Recently we showed you the benefits of microservices in product migration. With this article, we’ll try to explain the microservices testing complexity.
This material is a translated summary of an article based on the experience of QA, Oleksii Ostapov. He describes monolith as software and one system that can be deployed and run on a single server. In this way, all modules are responsible for different business logic and placed in one application and run in one process.
Here are the main myths vs implementations of microservices:
- Microservices are difficult to test atomically. Working with data greatly depends on how this data is distributed in the system. If the data is very much interconnected, it is possible that these are not microservices at all.
- It is difficult for microservices to manage data. Each microservice can have its own separate database, unrelated to other microservice databases.
- Transactionality is difficult for microservices. Looking at the whole system, it may not be obvious what kind of microservice’s error occurred – you need to take logs and data of all services to be involved and checked. In monoliths, transactionality is often guaranteed at the database level.
- Microservices can use different communication channels. Each new communication channel complicates testing and often requires the installation of custom programs.
- For microservices, it is difficult to do automated UI testing. In fact, developing self-tests is easy, and the same Selenium WebDriver does a good job.
- Microservices need more endpoints and data between services. The monolith may contain many web services created to perform the business functions of the program. But there will be more microservices because we also add technical services to connect microservices to each other. And everything needs to be tested.
- In microservices, it is harder to find the root cause of the error. The tester’s basic instruction requires fixing a bug that must be reproduced and certified with all prerequisites, steps, expected results, etc.
- Microservices require a lot of resources. When the system has a resource limit, it can cause bugs and the inability to add another test container in time.
In general, the complexity of microservices infrastructure has changed the approach to programming. It’s also important to understand that microservices are much easier to test than UIs, but you need to be able to code – effectiveness covers the functionality and integration of microservices.
To find more about our experience working with microservices, read how a Rails app can grow into a microservices architecture.