Hi , this is Json code for Employees that I have created
{
"Employees": [
{
"id": "1",
"name": "RAMESH",
"Location": "India",
"phoneno": "8223345881",
"courses": [
"mechanical",
"Blast furnance"
]
},
{
"id": "2",
"name": "Hritik",
"Location": "India",
"phoneno": "9902115881",
"courses": [
"electrical",
"Electric Departement"
]
},
{
"id": "3",
"name": "Shashi",
"Location": "India",
"phoneno": "7789923381",
"courses": [
"Diploma-safety deparment",
"Resource Departement"
]
}
]
}
To validating Response Body through test
const jsonData = pm.response.json();
pm.test("Test data type of the response", () => { pm.expect(jsonData).to.be.an("object");
pm.expect(jsonData.name).to.be.a("string");
pm.expect(jsonData.id).to.be.a("number");
pm.expect(jsonData.courses).to.be.an(array);
});
I’m getting this error msg in the test window
" AssertionError: expected [ …(3) ] to be an object "