pm.test("Check the value of the message parameter:" + pm.environment.get("valueOfMsg"), function () {
var jsonData = pm.response.json();
pm.expect(jsonData.message).to.eql(pm.environment.get("valueOfMsg"));
error Checking the value of the parameter message:Request Successfully Executed | AssertionError: expected undefined to deeply equal âRequest Successfully Executedâ
Is this for some training youâre taking? Something else? Are there links to that, that you can provide?
What are the responses of those requests that youâre testing against? Are there any snippets, codeblocks or screenshots that you can provide?
Basically, this jsonData.message is undefined so check what that value is. The Postman Console can help here.
You need to assume that no one else can see or has any knowledge of what you have in front of you - over share all the information and build a picture of the issue is so that people can help you.
This is producing the âundefinedâ error. Get used to console logging the elements you are trying to target. Start by console logging the whole response, and then target each element one level at a time until you get to the key/value you want to actually assert. The usual issue here is data within arrays.
Without seeing an example response. We canât help you here.
I canât know this as the homework only includes screenshots and parsing of these snippets .
If you write value in the body, the test will still fail. I want to figure out why this happens, I have tried everything I can.
I think youâre better off asking who ever set that homework, for more information if you donât understand what they want you to do.
We still havenât see what the response body for that request looks like - the test is testing that. Itâs testing whatever is returned in the message property, matches that variable value.
There is a lot of contextual information here that youâre not sharing which makes it impossible for anyone to actually provide you with a solution.