Instant Virtual Service Creation using MounteBank-Proxy
Proxies are one of the most powerful features of a MounteBank. Proxies support record/replay behavior to easily capture a rich set of test data for your test scenarios.

Using proxy we can record the traffic between applications or AUT and upstream or downstream services as shown above. Finally processed the captured data and create a virtual service out of it.

Assume our service end-point: http://httpbin.org/get
We need to create a virtual service for it using the proxy feature of MounteBank. Start the MounteBank using GitBash

We need to set up the proxy for it. Following is the configuration file needs to be created.
In this file, as you see, the proxy mode is set as ProxyOnce. This mode forwards the request to downstream service for the first call and then mountebank will capture its response data. If there is the same request, mountebank will replay the recorded response without calling the downstream service. Open another GitBash terminal and just run as follows.

The Terminal where the MounteBank is running, you will see as follows

Now, the proxy service for MounteBank is on and in listening mode. So we need to send a request, to the endpoint which will be http://127.0.0.1:9907/get since the port we defined in the config file to listen is 9907.MounteBank internally redirects to the original service in between and it will capture the Request & Response.

You can save the recorded stub in the file by using the mb save
command and can use --removeProxies
the command for removing the proxy configuration in the saved stub.
mb save savefile --CaptureResponseByProxy.json --removeProxies
It will save the captured stub file as follows along with the log files as follows.

Finally, to rerun with the recorded, we need to run the following command.
mb restart --configfile <filename>.json

Now the stub is running with the captured data. When we hit the endpoint it will revert with the captured response.

The stub file created by it is as follows.
You can simply modify the predicates and content of the body to satisfy all the necessary requirements of the AUT. We can leverage it to run performance tests for our back-end and front-end apps.
Similarly, if you are looking to create XPath, Script, and Analysis of the existing automation scripts instantly you can use the web extension tool TruePath.
As always, if you get stuck, ask for help.
About author Sumit: QA for 15 years and passionate about Test Automation, Service Virtualization, Web service, DevOps & ETL-BI Testing. Currently working for a leading telecom company CenturyLink as an offshore Automation COE lead. Please connect with him on LinkedIn.