How to test a data loop by calling an array variable created in another request

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question: I would like to do a data loop test by creating an array in another request.

Details (like screenshots):

You will get the variable that generated the array when you use it in another request, but when you call it, you can’t always bring the generated array and turn the loop.

Is there a way to run a data loop test on an array generated in another request?

How I found the problem:

I’ve already tried:

You can save your array to a collection variable, and then use it in another request.

What exactly is it you want to use the array\loop for? What is the next request doing?

Do you want to loop though the array and make separate post\get requests?
Or do you want to loop through the array as a test.

If you want to loop through the data and make separate requests, then you will have to do this by adding those requests to the test tab of this request, using sendRequest.

As always, please provide screenshots of what you have so far, as it helps with the context.

This should include the request\response, and any code in the tests tab. (Anonymised appropriately of course).

The values ​​you create in the array are what should go into the parameter values ​​shown in the picture.

I got an array variable and brought it in, but I tried a loop test, but I don’t know what format it should be because only the first value is in the parameter value.

Therefore, currently I was trying to put fixed values ​​in the array and proceed with the loop test. Is there a way to sequentially put the array values ​​into the parameters after saving them?

I’m still not sure what you are trying to do.

Will that form element take an array?

The pre-request script will run once, and the underlying request will also only run once.

In your example, your request will only run once with the last entry in those arrays. It won’t loop though them if that is what you are thinking. It will run with the final entry that is stored in the variable(s).

If you want this to loop through the elements, you have a couple of options.

First option is to create a CSV file and use the Postman runner with the data file as the input.

This will run the request once for each line in the CSV file.

If you are running another request first to populate the array, then you have the option of creating a loop in the tests tab of that request using sendRequest.