I am trying to test results returned in plain text (rather than in JSON). When I submit a request (with missing data) to our API I get a response in plain Text
example of response : {“Result”:false,“Message”:["‘forename’ must not be empty."]}
My test is this:
pm.test(“Response should contain Result equals ‘false’”, function () {
let jsonRespData = pm.response.json();
pm.expect(jsonRespData).to.have.property(‘Result’, false);
pm.expect(data.Message).to.equal("‘forename’ must not be empty.");
});
The section of the test to check the message always fails with the fail message:
Response should contain Result equals ‘false’ | AssertionError: expected undefined to equal ‘‘Title’ must not be empty.’
and I can’t work out how to get it to pass.
Any help will be appreciated.