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
- How can I optimize the number of API calls during test setup and teardown?
- You can use the PUT /imposters API
call to combine cleanup of the previous test run's imposters and setup of the new
test run. If you need to do mock verification, the
DELETE /imposter call will return the
- How can I split my imposters into multiple files and have them automatically
- See the
--configfile command line option
It can either be a single file containing the JSON that you get back when you call
or multiple files that will be collected via templating.
- How can I change imposters once I've created them?
- You can't - imposters are immutable through the API once created. The expected workflow
is that you recreate the imposters rather than mutate them, which is a lightweight operation.
- 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.
- How can I set up mountebank to support CORS pre-flight requests?
- A future version of mountebank will make this easier, but for now you can follow
the advice on
- 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 leave off the
--debug command line flags (which are
disabled by default) so mountebank isn't leaking memory. As long as you set up each
instance with the same configuration, you can run multiple instances behind a load balancer. Given a
reasonable hardware setup, organizations have reported managing 200-250 TPS per instance. A common
strategy is to set up a proxy in
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.
- Does mountebank proved service virtualization?
- Yes! Service virtualization is the term that commercial vendors use that
came out of the SOA tools, and essentially just means over the wire test doubles, which
is something mountebank knows a thing or two about. Unlike commercial service virtualization packages,
mountebank is free of charge, so there are no licensing concerns preventing you from pushing the
tests to the left of the project lifecycle. mountebank is also far more friendly of continuous
integration and continuous delivery than commercial software. A key goal of mountebank's approach
to service virtualization is that the intelligence of what will be returned by the test double belongs
as close to your test as possible, which is why he makes it easy for you to customize the response
on a test-by-test. Putting the intelligence in the tool means that the tests become victims of your
environment rather than rulers of it.