Chapter 5. Adding record/replay behavior
This chapter covers
- Using proxy responses to capture real responses automatically
- Replaying the saved responses with the correct predicates
- Customizing proxies by changing the headers or using mutual authentication
The best imposters don’t simply pretend to be someone else; they actively copy the person they impersonate. This mimicry requires both observation and memory: observation to study the behaviors of the person being impersonated and memory to be able to replay those behaviors at a later time. Satirists on comedy shows like Saturday Night Live, where actors and actresses often pretend to be famous U.S. political figures, base their performances on those skills.
Mountebank lacks the comedic flair of Saturday Night Live impersonators, but it does support a high-fidelity form of mimicry. Rather than creating a canned response for each request, an imposter can go directly to the source. It’s as if the imposter is wearing an earpiece, and every time your system under test asks it a question, the real service whispers the answer in your imposter’s ear. Better yet, mountebank imposters have a great memory, so once the imposter has heard a response, it can replay the response in the future even without the earpiece. Thanks to the magic of proxy responses, a mountebank imposter can be almost indistinguishable from the real thing.