Random numbers from array into postman test

Hello @Natasha.HildrewBrown, welcome to the community! :wave:

Pardon me if I misunderstood you.
So, according to what I got is you have an array of random numbers and while sending the POST request, that array needs to be sent as the part of the request body.

Well,
Here’s an answer that’s 90% close to what you’re trying to achieve.

The answer above is related to using the variable from datafile in collection runner, however you can ignore that and jump ahead.

So instead of this line:

let productLine = pm.iterationData.get('productLine');

you’ll be writing something like:

let productLine = pickOne; // Or whichever array you want to send

You’ll need to just assign your array.

You can tweak around more, by exploring the amazing concept of variables in Postman.

Let me know if you’re still stuck with this!

1 Like