Manning Publishing has been kind enough to help diagram the following mental model, describing how mountebank works:
- A server representing a test double. An imposter is identified by a port and a protocol. mountebank is non-modal and can create as many imposters as your test requires.
- A set of configuration used to generate a response for an imposter. An imposter can have 0 or more stubs, each of which are associated with different predicates.
- A condition that determines whether a given stub is responsible for responding. Each stub can have 0 or more predicates.
- The configuration that generates the response for a stub. Each stub can have 0 or more responses.
- response type
- Defines the specific type of configuration used to generate a response. The simplest type is called is, and allows you to define the imposter's response directly. mountebank also supports a proxy response type, which allows record-replay behavior, and an inject response type, which allows you to script mountebank responses. Each response has exactly one response type.
- stub behavior
- Adds additional post-processing to a response, for example by adding latency to the response or augmenting the response with more information. A response can have zero or more behaviors, which represent a pipeline of such transformations.