Failed Tests Added Correctly | TypeError: Cannot read property 'event' of undefined

My question:
I have added the status 200 test as per the documentation and set collection variables user_id and session_token as token but one of my tests is failing during submission.

I tried adding a bunch of pm.expect and test functions to no avail.

hI @abhisheksatya

Try changing;

const res = pm.response.json().response;


const res = pm.response.json();
1 Like

Hey @w4dd325
I did the change you mentioned but the issue still persists. I tried the following things.

  1. Change that you specified.
  2. const result = pm.response.json() and then const res = result.response. The reason being in the response body, the object is of the form below. So I need to use pm.response.json().response;

response: {


Just noticed, I think you are missing a semicolon after the top statement;

pm.test("Status code is 200", function () {;

See if that works, if not, can you share a screenshot of your response so i can see the JSON structure please?

Hey @w4dd325, never mind, got the solution.

I forgot to add the 403 status code in the final request in the new user workflow folder. I did it and worked.

Apologies for the silly mistake :sweat_smile:

Thank you so much for the help!

1 Like