AssertionError: expected ' ' to deeply equal

Hello @moorthiraj

Thanks for your comments, I tried with
pm.expect(0).to.eql(pm.globals.get(1));

but, I am still getting the AssertionError: expected 0 to deeply equal undefined, as message.

Hi @Raja2242

If the error is coming as ‘undefined’ means,

then log the values of the variable you are getting globally as,

console.log(pm.globals.get(1)); //should show the respective value

But we will save the a value globally as a variable right! So could you provide the variable name to call there like,

console.log(pm.globals.get(“variableName”));

I tried in my end and advising this. Please check and let me know if you have any issues.

Hello,

I have an issue with a test. I am looking to check the length of element “skuId”

{
“order”: “A1822”,
“style”: “VQ35”,
“detail”: [
{
“Area”: “ITALY_FRSE”,
“skuDetail”: [
{
“skuId”: 119406,

My test looks like that:

let jsonData = pm.response.json();
jsonData.detail[0].skuDetail.forEach(function(article) {
console.log(article.skuId);
pm.test(“Body matches string”, function() {
pm.expect(6).to.eql(article.skuId.length)});
});

==> I am getting this error "
Body matches string | AssertionError: expected 6 to deeply equal undefined"

Any help would be highly appreciated !

@bpricilla Hello I Have Issue with a test. I need help . AssertionError: expected 2089 to deeply equal ‘2089’

pm.test(“Search By Customar Id”, function () {
var jsonData = pm.response.json();
pm.expect(jsonData.user.id).to.eql(pm.collectionVariables.get(“id”));
console.log(pm.collectionVariables.get(“id”))
});

@abir009876 Welcome to the community :partying_face:

This error explains that the value is same but the data type is different here. Please check the data type of the userID. Seems like it’s stored as string. In that case, you need to use stringify() method for the collection variable “id”.

@bpricilla Hello, I Have Issue in this test and I need a help ,
Can you please look into this error and answer it.
I’m beginner and don’t know how to resolve this error.
TIA

@telecoms-operator-87 Hello!! Not sure if you managed to fix this :smiling_face: Let me know if you still face issue here!!

Hi Team,

Kindly help me on this one again… have used the method – parseInt(“10080”) but still not working.

let jsonData = pm.response.json();

let multiAcctNum = jsonData.members[0].memberNumber;
console.log(multiAcctNum);

pm.test(“Verify the multiAcctNum value is 10080”, function() {
pm.expect(multiAcctNum.memberNumber).to.eql(parseInt(“10080”));
})

FAIL : -Verify the multiAcctNum value is 10080 | AssertionError: expected undefined to deeply equal 10080

@ppoorna

This should have probably been a new question.

You have already defined the variable multiAcctNum down to the memberNumber element.

Therefore the assertion should be.

pm.expect(multiAcctNum).to.eql(parseInt(“10080”));

Although why do you need to parse the number. The following should work.

pm.expect(multiAcctNum).to.eql(10080);


Please Help! @bpricilla
Why this error is being displayed? Kindly tell how to proceed!

Waiting for your reply @bpricilla

@payload-observer-938 Usually this “undefined” pops up when it couldn’t locate the path of the JSON element. Please paste your JSON response in this JSON path finder tool. This helps you to break complex responses. If you are stuck, you can read this blog to understand more about the tool :slight_smile:

Can’t find it! @bpricilla
The same doubt was asked by @telecoms-operator-87 .
Kindly tell it’s urgent!

Waiting for your answer @bpricilla

@sseenivasan89 Kindly help on it!

Hi @payload-observer-938

the json path seems to be not valid one, possible can you share the response json to find the right path



@sseenivasan89 Sir please view it! I am not able to solve this problem. Would be greatful to you if you help me solve this error.

@sseenivasan89 Waiting for your Response!

@michaelderekjones Could you please help me out in it?
Disclaimer: I am a Beginner.

@payload-observer-938

please share the json response body not your test