Mastery of Mocking is Critical for Testing Modern API-driven Applications
API Mocking is Critical for testing Modern API-Driven Applications
The complexity and variety of service interactions is increasing in modern applications. Most applications today are architected as a collection of API-driven services. In the extreme, we are also witnessing a rise in the adoption of microservices. There are many reasons for an increase in adoption. However, this also has spawned an additional burden of “service testing” for engineering teams.
Service tests are good for early (even pre-submit) validation of integration with other microservices – validating new functionality as well as identifying regressions in existing functionality. Each service test issues a request and compares the actual response (or elements within the response) with the expected response. All regression requests to upstream services are mocked for the test. Thus, service tests can be run independently for each service, and potentially on a developer’s laptop. The following picture illustrates the service tests for a microservice “Order Service” which depends on upstream microservices “Order Details” and “Payments” (which are mocked).
Service Tests Enable Shift Left
The following test pyramid evangelized by Martin Fowler has been widely recognized as the ideal scenario in the context of distributed and micro-services architectures. It is important to focus on service tests to quickly and easily identify service integration issues. The ability to create and run these service tests as easily as unit tests is becoming critical for engineering teams.
Recommended by LinkedIn
API Mocking is at the Centre of Service Testing
Challenges
Ideal API Mocking Solution
For Adhoc service testing, it is critical for developers to be able to use a mix of live services and API mocks, and to easily customize mocks.
For automated service testing
As always, Bhaskar clearly and concisely illuminates important thoughts about systems testing in a way that helps practitioners and leaders keep them in the forefront ""Yes, of course!" I thought as I read through this article -- but the contribution is that I am now thinking about it. An challenge that seems significant to me that Bhaskar didn't mention explicitly is to avoid forgetting that a service test has been mocked when the actual service is available! Perhaps another article could explore means to try to overcome that challenge.
Very informative. Thanks for sharing your insights
Very good write up and nicely articulated!!
Very good write up. Excellent
Quite useful Information. Thanks for Sharing!