Newbie here to Postman, JS, API testing etc. so please bear with me. I come from a test automation background and am trying to use Postman to do something that seems reasonable but am not sure how to pull it off. I’ve been playing around and think I have a pretty good handle on environments, variables, data files, collections, etc. and will try to use the correct terminology. Please correct me where I may be wrong/off base.
I am working on a bit of a POC where I am sending a request to a web service that returns a JSON formatted document list with elements such as document type, document id, document date, etc. given an account number.
What I want to do is validate each of the elements for each document returned within a single request against the iterations in the data file without submitting the same request for each iteration of the data set. I’ve played around with data files and see references to the data object but am unclear on how to reference the array sections and enumerate on them similar to how one can in the response. I am using JSON format for my data file based on the example here: https://www.dropbox.com/s/o2cguyx4iv053j6/data-article.json?dl=0
If this is possible, I have a few more questions. If my data file has 5 array sections in it but I only run one iteration, are all sections of the data file loaded into the data object or is only the first iteration loaded? Will I have access to each section of all of the data sets in the data file in this scenario?
I’m able to access the individual elements of the data file when using the collection runner and running all iterations in the data file but haven’t figured out how to access and enumerate through the entire data file programmatically. I’ve tried using data.length to get a count of the sections but it returns null.
Any insight on how to do this would be greatly appreciated.