We recently wrote and shared a user defined policy called API Mocka to help you simulate responses directly from the API Connect Assembly. API Mocka is a quick and easy way for application developers to leverage the API Assembly for simulating the testing of APIs without calling downstream systems. Today we’re sharing an additional user defined policy, Latency Injector, to enhance your API testing experience.
When you are mocking up an API for testing an application it needs to be as realistic as possible. API Mocka allows you to simulate responses, the Set Variable policy allows you to simulate headers but until now, there wasn’t an available policy to simulate the latency of a backend system. Meet API Connect Latency Injector.
The API Connect Latency Injector is a User Defined Policy that simply increases the time taken to respond. If your backend system takes 300ms to respond, simply add 300ms to the policy. Do you need to simulate your backend systems over a much slower connection? Increase the latency as required.
The API Connect Latency Injection Policy is available on GitHub at https://github.com/ChrisPhillips-cminion/APIConnect-Policy-LatencyInjector/