Postman – Set Timeout / Think Time / Pause / Delay

Those who are involved in API or web service development should be knowing about Postman, it is one of the most popular tools to build API requests and test them.

Collection Runner is one of the feature of Postman. You can create one or more requests and group them in Collection, and as name suggests, you can run the entire collection i.e. series or requests.

What if you need to add “Think Time” or “Delay” or “Pause” between two requests? It is surely possible, here are some options:

  1. Using Collection Runner GUI
    • This option will be applicable to all the requests in the collection
    • In the Collection Runner window, enter value for Delay in milliseconds
  2. Using Command Line
    • This option will be applicable to all the requests in the collection
    • Newman is a comman line collection runner for Postman
    • Command To Execute: newman run <collection-file-source> –delay-request [number]
    • Click here to get the details about Newman
    • Newman installation instructions are available here
  3. Using Script
    • This option can be used in individual requests
    • You can configure different Delay values for individual requests
    • To configure the delay, you have two options:
      1. Delay before executing the request
        • Select individual request
        • Click on “Pre-request Script” section
        • Include this function: setTimeout(function(){}, [number]);
        • Replace [number] with time in milliseconds
      2. Delay after executing the request
        • Select individual request
        • Click on “Tests” section
        • Include this function: setTimeout(function(){}, [number]);
        • Replace [number] with time in milliseconds

Leave a Reply

Your email address will not be published. Required fields are marked *