mountebank - over the wire test doubles

Fork me on GitHub

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 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 requests array.
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.
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.
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 --mock and --debug command line flags (which are disabled by default) so mountebank isn't leaking memory. As long as you set up each mb 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 proxyAlways 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.
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.