Iterate 1 :
Request body:
'''
{
"SocialMediastatus": "Active"
"personID: 1
}
Response body:
{
WhatsApp : Active
}
====
Iterate 2 :
Request body:
{
"SocialMediastatus": "Active"
"personID: 2
}
Response body:
{
FB : Active
}
====
''' So now I need to test in Postman tool whether the response has the expected keyvalue pair. Solution I used: I used csv file & run using CollectionRunner with below data SocialMedia,SocialStatus WhatsApp,Active FB,Active
Test I added in Test tab:
pm.test("Test key", function () {
pm.expect(pm.response.text()).to.include(pm.iterationData.get("SocialMedia"));
});
pm.test("Test Value", function () {
pm.expect(pm.response.text()).to.include(pm.iterationData.get("SocialStatus"));
});
but These are validating key & value separately. But Can I need to iterate key also in JSON response data . I need to iterate json response has both "WhatsApp" Key & it's value as "Active" from csv file. Then Pass the Test