Hi All,
I am getting the below issue once I run the collection for the multiple set of data (Users.csv).
End Point: dummy.restapiexample.com/api/v1/employees
HTTP Method: GET
Code:
pm.test(ā200 statusā, function() {
pm.response.to.have.status(200);
});
pm.test(āResponse timeā, function(){
pm.expect(pm.response.responseTime).to.be.below(4000)
});
const auth = undefined;
console.log(auth?.employee_name); // undefined
console.log(auth?.employee_name?.employee_name);
pm.test(āVerify login userā, function() {
const response = pm.response.json();
pm.expect(response.json.employee_name).to.eql(pm.iterationData.get("Emp_Name"));
pm.expect(response.json.employee_salary).to.eql(pm.iterationData.get("Emp_Salary"));
pm.expect(response.json.employee_age).to.eql(pm.iterationData.get("Emp_Age"));
});
Error:
Verify login user | TypeError: Cannot read properties of undefined (reading āemployee_nameā)
Please assist on resolving this issue.