Working in a distributed system is going to affect how you approach testing. In an article for Business 2 Community, Carey Wodehouse discusses six types of testing and how they are suited to microservice architectures:
- Base testing
- Unit testing
- Integration testing
- Load testing
- Stress testing
- Resiliency testing
End-to-end base testing just examines on a fundamental level if the software actually works. Wodehouse says it also works out the “steady state” of the distributed system. These are obviously important things to know. Unit testing should be fairly straightforward too, and perhaps even more so than usual since microservices are already divided by nature.
Integration testing looks at how well the microservices interact with each other, whether through APIs or other means. Errors at the protocol level are rooted out with this testing.
Load testing examines how an app will hold up during regular daily use, and stress testing examines what happens when an app must deal with extreme volumes. About the former, Wodehouse writes this:
Be sure to mix up what you put your app through in testing with different events and combinations of events that might threaten the stability of your app. Test for a high volume of calls. Create tests to see how the app as a whole performs when one microservice needs to transfer a large amount of data to another. Test for big events, or smaller, day-to-day events. The idea here is to identify any weaknesses like aberrant behaviors, outages from too much downstream traffic, response time latencies, or the effects of too many “retries” if timeouts aren’t properly set up.
The network will often be the bottleneck and this type of testing will uncover what parts of the app aren’t scalable enough to keep the app from melting down under a high volume of traffic.
Lastly, resiliency testing measures what happens when an app fails. The goal is to minimize the level of failure that an app experiences and prevent failure from cascading.
For a deeper discussion of how to apply these tests to microservices, you can view the original article here: https://www.business2community.com/brandviews/upwork/6-types-testing-know-microservices-architectures-01902537