Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
151
rated 0 times [  157] [ 6]  / answers: 1 / hits: 21664  / 7 Years ago, thu, december 7, 2017, 12:00:00

Is there a simple way to capture the Response times for the requests and responses in a PostMan script?



I am trying to do the following by creating a Collection and then in the Tests, writing the following script to capture and put the value in an Environment variable:



postman.setEnvironmentVariable(MyURLRequest, (responseTime));


This provides me the value in the Environment variable, but I need to specifically go there everytime to check the time.



The other way I have tried is to use the 'Runner' on the collection and get the response times from the totalRequestTime value in the exported results. But as I am running ~50 requests, it becomes hard to capture the same for each individual request.



Has anyone tried this earlier and been able to get a better way to capture and export a response time value for each request sent out?


More From » performance

 Answers
13

You could use the built-in pm.response.responseTime function to get the times.



Add it to a console.log(pm.response.responseTime) in a test, to try it out or assign this to an env/global variable.



You could even (it's a little bit over kill though) do this:



Response



If you didn't want it in each test, this could be added to the collection. On the latest version, press edit on the collection to see the options.


[#55734] Monday, December 4, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
donaldcristianl

Total Points: 114
Total Questions: 95
Total Answers: 110

Location: Bonaire
Member since Sat, May 27, 2023
1 Year ago
;