Search code examples
postmanpostman-collection-runnerpostman-pre-request-scriptpostman-testcase

Setting timeout for postman collections


I want to run the Postman collection with timeout enabled at the collection level. Is this setting possible at the collection level in Postman? I know that the timeout can be set per request using setTimeout(() => {}, 15000), but I could not find something similar to run the collections.


Solution

  • Request timeout for single call

    Postman has a setting that you set manually in Settings > General > Request timeout in ms that you can set if you want to set an explicit timeout. However, you won’t be able to do what you’re trying to do from a script.

    You can, however, write request tests to make sure your response times are under a certain threshold. That way when you run the request, the test will fail if it’s slower than say, 800ms:

    pm.test("Response time is less than 800ms", function () {
        pm.expect(pm.response.responseTime).to.be.below(800);
    });
    

    According to https://community.postman.com/t/request-timeout-for-single-call/6881/2