Bottom Up Microservices and API Testing is Disruptive, but Effective

Story

No matter which technology, platform, or tool you engineer your microservices or APIs on, many engineers are following the Model-View-Controller (MVC) like design pattern of using API layers in their solution architecture. Some classify this approach as: Experience, Process, System layers of microservices and APIs. Others have different vocabularies for these same layers, but semantically, they are often the same purpose. Categorize microservices and APIs into layers and hierarchies. Common Object Oriented programming techniques. In Microservice and API Testing, its important to test all layers of your solution. In a different article, we will explore the order of developing each layer.

This article illustrates the order for microservice or API Testing, whether it be Unit Testing, Integration Testing, or Performance Testing.

The Testing concept is pretty simple: Test your layers Bottom-Up. Test a bottom layer Microservice and API first. Once passed defect free, test the next layer up if such a layer exists on the same Microservice or API. (Note, its important to Test Case each Microservice and API independently to remain “Agile compliant”, so you don’t necessarily have to Test Case every Microservice or API in the layer). This approach allows you to test lower levels of solution granularity, and move up the chain as test cases pass, to test more coarse grained levels secondarily. Why? Because its a process of elimination to minimize possible defect impacts and scenarios, and allows the Test Team to eliminate potential defect impacts. For example, if you find a defect in a higher layer of your microservice or API, there’s a good chance the root cause is not from a lower level microservice and API, because you already passed the test case.

What’s the last architecture layer to test? Answer: The Application or System User Interface. Only after the core Microservices or APIs pass, then you test your App. (Again, keeping agile concepts in mind, you can test an App page or a component in your App, so your not waterfalling into all APIs being built in order to test the App or UI). Testing your App or UI before testing your middle tier will just lead you on a wild goose chase trying to determine the defects.

The graphic below illustrates the Bottom Up Microservice and API Testing approach:

Bottom Up Microservices and API Testing

The reason why I say it’s “disruptive”, is that many Quality Assurance and Testing teams have traditionally tested Top Down. So, this approach is different than how they have done testing in the past. With change comes opportunity !

 

Jordan Braunstein, CTO