Mocking a server that does not contain the endpoint under test

I am relatively new to Postman. I have a situation where we are testing endpoint calls to out back end. The processing of the endpoint call includes an endpoint call to a third party server. In some of tests we want to access the third party server. In other tests we want to mock the calls.

One possible solution is using Mountebank to create an impostor for the third party server. I know that will work, but that involves engaging and disengaging Mountebank outside of the test environment.

We would like to run the tests against a common test environment and I fear other users of the test environment would be affected by the impostor coming up and down in the background.

I am looking for a way to mock the third party server calls from Postman.

Is this what your looking for?

Postman Mock Server documentation

I did look at that document before I posted the question. I may have interpreted it incorrectly, but the mocking appeared to be mocking the response for the current request. My issue is that the call I want to mock is not the call I am testing. See the diagram below:


To process the request, the backend service makes a call to a third party API. I need to mock those calls.


Oh ok, I misread the question.

You own the backend service, right?

You can still create a mock server and have your backend service call it via code.

The problem I am trying to solve is the transition between calling the third party server or using a mock server. I had hoped that we could drive the third party mocks from the test thus avoiding the transition.

We want to avoid putting mock-related code into the product code. Since we can accomplish this with Mountebank without modifying the product code, we will probably pursue that as a solution and live with the process to turn the Mountebank imposter on and off.

I am assuming that using a Postman mock server would involve some code changes to the back-end service. In the interest of completeness, I will look at the Postman Mocking doc to see what is involved.

Thank you for your help on this.



Ok if you don’t want to modify the backend code, then Postman isn’t going to be able to help you out here.

I hope you find an easy solution that works for you!

Can you point me to an example of what modification would need to be made to the backend code to use a Postman mock server?



That’s a pretty big ask. I don’t know what your backend looks like, how you’re making calls, what language you write in, etc…

What I can tell you is that Postman has a generate code snippet functionality that will build the code you need to execute a request.

I am doing a proof of concept on the mocking of embedded endpoint calls made during the processing of a Postman request. Can you point me to documentation on how to set it up. We are using a Java back-end. The calls to be mocked are from a java micro-service to a third party API.

I have gone through and it seems to focus on mocking the result of the Postman call.