mountebank

mountebank - over the wire test doubles


the apothecary

Frequently Asked Questions

How do you pronounce mountebank?
mountebank pronounces it with a plain and unpretentious accent, reflecting his humble roots as a man of the people.
How can I post-process a response, for example, to add a custom header to a proxied response or add a current timestamp into the response
See the decorate behavior for general purpose decoration. You can inject headers into proxied responses using the injectHeaders field
How can I split my imposters into multiple files and have them automatically loaded when mb restarts?
See the --configfile command line option It can either be a single file containing the JSON that you get back when you call GET /imposters?replayable=true or multiple files that will be collected via templating. Alternatively, starting mb with the --datadir command line option will load all previously saved imposters in the database.
I'm adding mountebank as an npm dependency to my project. Why isn't npm shrinkwrap working?
This is actually a npm issue, not a bug in mountebank. Mountebank is published using npm v3, which modifies the behavior of where npm dependencies are installed. npm v2 does not expect this, and will throw errors because of it when trying to shrinkwrap. Upgrading to npm v3 solves this issue. If for some reason you are stuck on npm v2, there is an only moderately inconvenient workaround. Add all of mountebanks top level dependencies to your own package.json. Then, between npm install and npm shrinkwrap, delete the node_modules/mountebank/node_modules folder. This workaround works for grunt-mountebank, if you are using that as well (thanks Adam Kalman for the explanation).
I'm proxying to a server that returns gzipped (compressed) data, but I'd like to save the data uncompressed. Is there a way to do that?
Yes! Using the injectHeaders field on the proxy, add an 'Accept-Encoding: identity' header. That's an HTTP-based way of the proxy client telling the server that it won't accept compressed data.
Can I use mountebank for load testing?
Yes, and field reports have indicated that mountebank may be the only open source service virtualization tool that performs under significant load. For any long-running process, make sure you run with the --datadir command line option so mountebank doesn't leak memory during proxy recording or saving requests. You'll also want to use keepalive connections for HTTP connections, so consider setting the defaultResponse to make all Connection headers as Keep-Alive. As long as you set up each mb instance with the same configuration, you can run multiple instances behind a load balancer (they should all share the same volume for the --datadir option). A common strategy is to set up a proxy in proxyAlways or proxyTransparent mode and to capture the downstream latency by using the addWaitBehavior field to the proxy. When you replay the saved responses, they will add the perform with roughly the same latency the downstream services had.
Why did you misspell impostor?
mountebank is not an educated man, having spent the waking hours of his youth caring for the poor and the sick.