Search code examples
automationpostmanpostman-collection-runnerpostman-pre-request-script

How can we set dependency in pre requisite of Postman Automation?


I have two Postman scripts:

  1. Issue offer
  2. Redeem offer

Redeem offer API is dependent to the Issue offer API. So, every time to run redeem offer, we need to run first Issue offer.

To do this how can we add issue offer to the Pre-requisite of Redeem offer?


Solution

  • In Postman, the concept is the other way around: You can use postman.setNextRequest() to set the next request to be executed.

    So in Issue offer, you call postman.setNextRequest('Redeem offer'), and after Issue offer is finished, Redeem offer will be executed.

    For more info, see https://learning.postman.com/docs/running-collections/building-workflows/