Test result in case of request looping

Hi Everyone,
I’m quite new in the Postman, so I would like to ask for help.

My scenario is:
1, Send data to the system
2, The system generates a response for the data. I have to validate the body of this response.

The service that generates the response is sometimes slow, so I’m using the setNextRequest function. We are using the collection-runner and my question is there any solution to show the result of only the last iteration?
This is not easy to find the real test result if we run more tests at once.

Run results:

Summary:

Thanks for your help!

Hi @davidruzsinszky-pros !

I’m afraid there is no native way to achieve this, but there’s a few work arounds that you could try:

Using Environment Variables : One approach could be using environment variables to track iterations. In the Pre-request Script, you can initialize a variable iterationCount and increment it each time the request is executed. Then, in the Tests section, you can conditionally run the validation tests only when the iteration count reaches a certain value.

Storing Final Response : Another way is to store the response of the last iteration in an environment or global variable. This way, even though you might have multiple responses, you can always see the last one from the environment or global variables panel.

Limiting Iterations: If you’re using setNextRequest to loop until a certain condition is met, you can set a maximum limit for iterations to avoid infinite loops and make it easier to identify the final iteration.

Post-Processing Results: After your Collection Runner completes, you can export the run results to a file. While this will contain results for all iterations, you could programmatically filter out or focus only on the last iteration’s results using simple scripting outside Postman.

Logging: Utilize console.log to print specific logs or responses in Postman Console. This will help you identify particular iterations or conditions easily. For instance, you can log the final response or specific test results.

Visualize: Postman offers a “Visualize” feature where you can format and display response data in a custom manner. You could use this to highlight or focus on specific parts of the response for clarity.

I hope this helps! Let me know if you have any further questions or if there’s anything else I can assist you with.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.