Postman Testing - How to add test scripts for Json response in array

Single Array Response:

pm.test("checking response data id", () => { pm.expect(responseJson.responseData[0].UniqueId).to.eql(pm.variables.get("site_id2")); }) 


 2D Array Response:

pm.test("checking response data ids ", () => { pm.expect(responseJson.responseData.data[0][0].id).to.eql("3"); pm.expect(responseJson.responseData.data[0][1].id1).to.eql("2"); pm.expect(responseJson.responseData.data[0][2].id2).to.eql("1"); })

Comments

Popular Posts