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.