Errors from Assignment #2 (Valentino Coffee House)

Hello everyone!
I`m trying to complete Assignment #2 and I get errors like:
status > Get API status: contains status code test | AssertionError: expected undefined to be an object

I have read the previous topics in order to find the solution, but no luck.

I followed the instructions, duplicated the folders, dragged them into the API Request folder, set the correct collection Id and started writing the test to check the status codes.
Tests passed when submitting the request manually, but fails with: “status > Get API status: contains status code test | AssertionError: expected undefined to be an object” when verifying my work.

Link to my public workspace: Postman

I know that only the status folder contains the script, but if I can pass this one, the rest is easy :slight_smile:

Can anyone help?

Hey @cosmin12348877 :wave:

Welcome to the Postman Community! :postman:

As it’s using the Postman API to check your Collection against the tests, what is that request returning? Are you sure it’s using the correct Collection ID?

  • Get the collection ID: Select the collection “Assignment #2” in the sidebar. Then in the context bar to the right, select the Info icon and copy the collection ID . Make sure you’re getting the ID for the collection, and not this request.

You wouldn’t see a manual failure because you’re not using the Postman API in the individual requests.

Hello @danny-dainton

Yes, I`m using the correct collection ID as shown here in the Verify my work call.

Otherwise, the test result for “Correct collection returned” will fail.

That’s information that wasn’t previously shared - I didn’t see the results :sweat:

What’s in the body of that request? The tests are asserting against that response body.

Sorry about that, I though that sharing only the error will help, as this topic was discussed 2 times already. My bad!

So, the params for checking the results are:

Header:

These are from the “Verify work” request

All the tests are failing due to the same reason, it’s looking for something in the response body that isn’t defined.

It order to know what that might be, I need to see the Body (In the same menu group as the Test Results) of the response:
image

ok, here it is:

From your shared Workspace link, the Collection ID doesn’t look the same to me.

https://www.postman.com/cosmin12348877/workspace/freecodecamp-api-test-automation-with-postman/collection/284990-17930873-8d28-487c-be12-ad9d3cbd83f7?action=share&source=copy-link&creator=8213448

Well, It looks like that was it, although I triple checked that collection id to be correct, I guess it was not.

Thank you so much

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.