I let Postman generate a collection by importing the related API. Postman generated examples for responses automatically.
Then, I mocked this collection.
For an incoming request Postman mock server was able to find a request/response only when I gave the x-mock-response-name header. This does not help, because the software under test cannot be forced to use this header.
Then, I setup Postman to be the sender and receiver of the request, and saved this as a new example response.
After this Postman is able to send this response from the mocked server.
Is there a bug in Postman when it comes to examples generated automatically while importing an API?
It’s happening if you import the Swagger Petstore API, for example.
Maybe I am doing something wrong. I recorded a video you can see it here PostmanMock.webm - Google Drive
This was not my original example but it’s proprietary code and I can’t share it. I also imported the collection from swagger, worked with the provided examples, created my own and tried many options. I got one mock server to work and when I tried to recreate it to add another call it stopped working.
Creating the mockserver myself worked correctly but I don’t have any option to update it so if it’s a work in progress you have to mock everything again any time you want to add something new to the mock server.
Thanks, Laura.
Yes, this is what I experienced too.
Even if I specified a value for a key, the request/response could not be found.
Only with x-mock… parameter a response was received.