Testing average response time with newman

Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.

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

postman.setNextRequest(null);

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

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.