# How to define max response time - for test

**URL:** <https://community.postman.com/t/how-to-define-max-response-time-for-test/21108>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [March 7, 2021, 5:48pm UTC](https://community.postman.com/t/how-to-define-max-response-time-for-test/21108 "2021-03-07T17:48:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flippiflappi](https://avatars.discourse-cdn.com/v4/letter/f/c37758/32.png) [@flippiflappi](https://community.postman.com/u/flippiflappi)\
**Post date:** [March 7, 2021, 5:48pm UTC](https://community.postman.com/t/how-to-define-max-response-time-for-test/21108/1 "2021-03-07T17:48:53Z")

</div>

Test server request limitation

Is there any way to set max response time?

For example - if you want to test if the server don’t answer after a fixed number of inquiries.

I want to define it in a test. Best without Javascript settimeout.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [March 8, 2021, 10:37am UTC](https://community.postman.com/t/how-to-define-max-response-time-for-test/21108/2 "2021-03-08T10:37:49Z")

</div>

Hey @flippiflappi 👋

Could you clarify the question more and add more context, please?

There are checks that you can do against the response time, for a set value you would like it be be below, above, within etc.

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

```

```auto
pm.test("Response time is more than 200ms", function () {
    pm.expect(pm.response.responseTime).to.be.above(200);
});

```

```auto
pm.test("Response time is with 200ms and 500ms", function () {
    pm.expect(pm.response.responseTime).to.be.within(200, 500);
});

```

---

<div class="post-metadata">

**Author:** ![flippiflappi](https://avatars.discourse-cdn.com/v4/letter/f/c37758/32.png) [@flippiflappi](https://community.postman.com/u/flippiflappi)\
**Post date:** [March 8, 2021, 12:13pm UTC](https://community.postman.com/t/how-to-define-max-response-time-for-test/21108/3 "2021-03-08T12:13:58Z")

</div>

It’s not about testing how long the response was.  
If the response takes too long, you should start doing something. So say, max response so long - do that …  
 → max response time for pm.sendRequest

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [March 8, 2021, 12:24pm UTC](https://community.postman.com/t/how-to-define-max-response-time-for-test/21108/4 "2021-03-08T12:24:38Z")

</div>

Without more extensive details of what you are trying to do - The only solution that people will be able to offer is just _guessing_ what you’re trying to achieve.

I would suggest looking through this guide and editing the original question and provide all the details.

> [@How to Best Ask Questions on Community to Get the Answers You Need](https://community.postman.com/t/how-to-best-ask-questions-on-community-to-get-the-answers-you-need/16912):
>
> Hello! Welcome to the Postman Community forum. We want you to get the most out of the forum as possible; your questions help others learn too. Here are best practices and forum etiquette to assist getting the answers you need. rocket Update: Using public workspaces to share your problem makes getting support even more easily. [Here’s how](https://community.postman.com/t/using-public-workspaces-to-get-help-with-postman/22418/). Search First: Thanks to the great Postman community, there are many answers for common questions already accessible. Try searching for keywords related to …

---

<div class="post-metadata">

**Author:** ![ptrckjhnbwln](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@ptrckjhnbwln](https://community.postman.com/u/ptrckjhnbwln)\
**Post date:** [July 21, 2022, 5:02am UTC](https://community.postman.com/t/how-to-define-max-response-time-for-test/21108/5 "2022-07-21T05:02:32Z")

</div>

I’ve tried to use this and it seems it will still wait for the response of the API before failing the test? Is there a way like if it reach the limit it will already fail the test? Or still it will need to rely on the response being completed?
