Hi, I’m trying to extract a particular field value in the response body using below script under Tests. Response body field path ‘appliedRules[0].resultType’ is supplied in the test data sheet column ‘responsefield’, since the field path changes for each iteration.
var jsonData = JSON.parse(responseBody);
var jsonField = pm.iterationData.get("responsefield");
pm.test("Error message validation", function () {
pm.expect(jsonData[0].jsonField).to.eql(pm.iterationData.get("error message"));
});
Assertion fails while collection run saying “expected undefined to deeply equal…”. The problem here is it looks for jsonField instead of value in jsonField variable. I tried with providing $ infront of variable, still it fails. Kindly help