newbie at JavaScript and Postman here.
I have set up a basic test in postman using JS to compare names in a web response to names in a data file. The array of names is in an external data csv file.
I want to loop through the array, but I get an error:
"ReferenceError | i is not defined"
Code:
var newResponse = responseBody;
let nameArray = data.name;
for (let i = 0; i < nameArray.length; i++) {
console.log(nameArray.length);
}
pm.test("Web vs. Data: Person", function() {
pm.expect(newResponse.Item[i].name).to.equal(nameArray.Item[i].person);
});
console.log(newResponse.Item[i].name);
console.log(nameArray.Item[i].person);