Day 14: OAuth , 30 days postman challenge for developers

My question:
Unable to clear this test in 30 days of Postman challenge, Day 14 OAuth. I’m new to postman and all suggestions are welcome.

Scripts added correctly | AssertionError: check collection variable set: expected ‘pm.test(“Status code is 200”, function () {\r,;\r,});’ to include 'pm.collectionVariables.set

This is the task:

  1. Add a test and script :
  • Add a Postman test to ensure a successful 200 response
  • Add a script to determine how many repositories are returned in the response. Save this number as a collection variable called repoCount . Confirm the script is storing this data properly and persist the data so that INITIAL VALUE is the same as CURRENT VALUE .


This is the solution request:-

This is the github request:-

I’ve already tried:
I’ve tried adding collection variable set , on both pre request script and test but nothings seems to be working.

Hi @harshi1037,

The screenshots of your tests look good to me. However, the message in the “Submit your solution” tests seems to indicate that it’s not found your entire script - notice how the text in the test failure after ‘expected:’ does not contain all of your test?

I think the solution may be quite simple. In your final screenshot, the ‘Save’ button is illuminated, which suggests to me that you have unsaved changes in your tests. The “Submit your solution” tests will only be able to access your most recently-saved changes (as it accesses the data via the Postman API).

So, if you click “Save” in your github request, and re-run the tests, hopefully it should now pass.

1 Like

Thanks a ton @neilstudd !
The test passed. And I also realized my changes weren’t saved after I closed the postman tab of my browser. I will definitely keep this in mind from next time.