How to set the iteration data for a specific request

Hi…

I have about 20 requests that are within their respective folder within the collection. Each request has its own specific data to test against. I want runner to execute each request with its specified data to test against. I have formatted the test data json file as such:

[
{
“/employees”: [
{
“firstName”: “John”,
“lastName”: “Smith”
},
{
“firstName”: “Jane”,
“lastName”: “Doe”
}
],
“/employees/{employeeNumber}”: [
{
“employeeNumber”: “10379”
}
]
}

]

Each property containing the array of data corresponds to a specific request name. So for request: “/employees” there are two iterations to test against. Once that test has completed for that request, the next request will test against its test data.

Hey @AngelNieves

As it’s iteration data, it’s the data that’s going to be used in that iteration.

You wouldn’t be able to use a particular part of the JSON data file, to run against a particular request.

You can use setNextRequest() to move to different folders but the data, if’s in the same iteration, would need to be match up to a key in the first object of the data file.

So how should I best handle testing the entire collection with one test file? We are looking at using newman to execute the testing of our collection of apis?

I don’t know that full context of your Collection and the way that data is used within it, to be able to answer that question.

As for data files though, each object in the JSON data file array would be the first run so all the data points you need for the entire collection would need to be in that object. The same for the next iteration.