Day 13: Newman (30 days of Postman for Developers)

Help me



I was set variable talls = 7 but it donโ€™t working :pensive:

You donโ€™t have anything in the initial value as per the instructions.

Then write a script to see how many species included in the first page of results have an average height greater than 100. Log this number to the console. Save this number as a collection variable called talls, and then persist the data so that INITIAL VALUE and CURRENT VALUE are the same.

Current values do not get copied to the Postman Cloud, so the tests in the submit request are checking against the initial value.

  let variable = collection.variable.find(variable => { return variable.key === "talls" })
  pm.expect(variable.key, 'check collection variable key').equals("talls")
  pm.expect(parseInt(variable.value), 'check collection variable value').equals(7)

In particular, I suspect this bit is failing as it will return as null (therefore Nan - not a number).

parseInt(variable.value)
1 Like