Missing Attributes

I am using the following code to assert on a response field and this code was working just fine a couple of days ago and now it is failing.

pm.test(‘my variable’, function() {
var jsonData = pm.response.json();
pm.expect (jsonData.applicationData.myvariable).is.to.equal(pm.environment.get(‘myvariable’);

I then did a console.log on the pm.response.json and when the data was returned in the console I noticed there were a bunch of missing attributes. If I POST the call via Postman and manually view the response I can see all the attributes. So I was wondering if there is an issue with Postman and using the pm.repsonse.json to where it is maybe not properly parsing the response? If not, I’ll continue to look on our side to see what could have possibility changed.

Putting the test code and logging out the data from pm.response.json() to one side.

Do you see the expected data in the response view?

The test sounds like it’s doing exactly what it’s supposed to be doing and acting as a change detector - Something has changed the shape of the response data.

One thing that you could do moving forward, it to create some schema validation tests, that would allow you to see what’s changed against a known schema.

Yes I can see the correct attributes in the response view. I just don’t see all the attributes in the response from the pm.repsonse.json.

Can you post a screenshot on the 2 things that you see please?

Does the endpoint have a filter? Any pagination?

Do you see the same from:

console.log(pm.response.text()) 

No filter or pagination I am aware of but will ask on that. Checking the pm.reponse.text now.

Okay I can see the missing attributes with the pm.reponse.text()

Without showing/displaying a visual comparison of what the response is and what you’re getting from the console log statement - it’s going to be tough to advise where to go here :joy:

Thanks for your help. I found that some of the data was being duplicated, as this is an issue on our side. Thank you again for your help.

1 Like