I have verified the length of input as var resp =(body.input).length and make sure it is not 0. But I also want to verify only firstname,lastname and rollno is available in each set and the count will be always 3. How to I verify this is postman Test?
Response body:
{
"success": true,
"input":[
{
firstname:"Ram"
lastname:"Lakshmanan"
rollno: "11"
},
{
firstname:"Pravi"
lastname:"Reshma"
rollno: "12"
}
]
}
My Test looks like below:
var i;
for(i=0 ; i< resp ; i++){
var resp_firstname = body.input[i].firstname;
pm.test("Verify first name is available and not empty",function(){
pm.expect(resp_firstname).to.exist;
pm.expect(resp_firstname).to.not.eql();
}