Testing average response time with newman

When testing some apis with newman, i’m tryng to test if the response time is lower than 200ms. sometimes, this test would file for environment condition, so i would like to iterate the request many times, and test the average response time instead of the single request response time. is this possible? how?

I guess, the simplest way would be to have a counter variable and at the end of your response testing stage you check if you need to repeat the request with

postman.setNextRequest("test name");

or you are done


For details, see https://www.getpostman.com/docs/v6/postman/scripts/branching_and_looping

1 Like

I use test script and put the test result with the response time. At the end of the Runner, I export the results which would be in json format.

Next I open the json file using Excel and focus only on test result. From there I will see only the test results on rows of Excel.

The problem is Test is not executed when there is time out or any other error during APi execution.