Looping Same request for multiple time for uploading file doesn't work on newman and testrunner with .setnextrequest

Have simple request POST, how to upload file for different files
TC 1- > Upload with .text file
TC 2-> Upload with .doc file
TC 3-> upload with .docx file
TC 4 - > Upload file with .jpg file
TC 5 → Upload file with .pdf file

image

@singhsivcan any leads

Why does it need to be the same request in a loop?

Can you not just make these all separate requests?

lol that’s the easy …did the same it increased my collection numbers though(which i didn’t wanted initially, but that solves the purporse though) :wink: and btw any idea why i get the this error "status": "JSONArray[0] not found works well in another environment, but when i change the env got this error.

Where are you using JSONArray? I assume that’s a variable you have somewhere?

Maybe it doesn’t exist in your new environment

Figured it out… its was not the variable though but Json body was corrupted with one line part :slight_smile: thanks for your inputs.

1 Like

@singhsivcan @danny-dainton request does executed 3 times in runners any help?

pre-request
pm.environment.set("counter", 3);

var currentCount = pm.environment.get("counter"); 
if (currentCount > 0)
{ 
currentCount = currentCount -1; 
pm.environment.set("counter", currentCount); 
postman.setNextRequest("NextRequestName"); 
console.log("Documents left: "); 
console.log(pm.environment.get("counter")); }