Calls over a network to an API can be delayed for many reasons e.g. network congestion or excessive server load. For applications to be resilient they must be designed to cope with this inevitable variability, and tested to ensure they behave as expected when conditions aren’t optimal.
In particular it is important to check that timeouts work as configured, and that your end user’s experience is maintained.
WireMock Cloud stubs can be served with a fixed or random delay, or can be “dribbled” back in chunks over a defined time period.
A fixed delay straightforwardly adds a pause for the specified number of milliseconds before serving the stub’s response.
Random delay adds a random pause before serving the response. Two statistical distributions are available:
Chunked dribble delay
Chunked dribble delay flushes the response body out in chunks over the total defined period:
Delays and proxying
Fixed or random delays can be added to proxy responses in addition to direct responses, however chunked delays cannot at present.