1

I am trying to write automated tests with Postman. I am new to postman automation world so sorry if the question will seem dumb.

In the api that I need to test when I send a request I immediately receive a response with a transactionID, no matter transaction succeeded or not. Along with my request I send a CallbackURL to the server where I expect the actual transaction result to be called back. The server will do a PUT request back to the CallbackURL that I have provided with the transactionID and the actual response or error.

So the question is, can I have such kind of scenarios in my postman tests? I guess I should run a web server and expose an endpoint which will expect a PUT request and I should get the body of this PUT request in my tests to check it, and respond back to it with success.

In other words, within my script I need to perform the following actions:

  1. Do a request to the server passing a callback URL
  2. check the immediate response from the server and keep the returned transactionID
  3. Have a webserver run with an endpoint that I passed as a callback URL
  4. Expect a request to that endpoint with transactionID and actual response
  5. Check that the response is what I actually expected
  6. Respond to the request with success

I was thinking about Postman Mock server, but seems it is not designed for such usage. I also think may be I can run some JS Webserver (may be nodeJS) inside the postman Sandbox...

Actually I am very new to postman testing and I am really confused about this kind of issue. Is it even possible to do this with postman or I need something else?

Andranik
  • 2,729
  • 1
  • 29
  • 45

1 Answers1

1

There are some features provided by POSTMAN which can help you to resolve your problem

  1. When you do request to server passing callback URL it gives you transactionID in response. Save that transactionID in environment variable or global variable. Same you can do it for callbackURL. Eg. pm.environment.set("transactionID", transactionID);
  2. Then you can do the second request where you passed callback URL and transactionID which you have already.

In short in POSTMAN there are features like

  • Set global and environment variable which helps to pass some values fetched from response to another request.
  • call other request on success of first request eg. postman.setnextRequest({{requestname}});

If you can mentioned your problem statement little bit in details it will be easy to answer in better way.

Hope This Will Help You

  • 2
    Hi. Thanks for answer. The thing is I don't need to do request from Postman second time, I need to listen to server doing call BACK to me – Andranik Jul 17 '19 at 10:40