30 Days Developer Postman - Day 26

Guys,

I might be missing something silly here. Can anyone help me here please? Collection link is https://www.getpostman.com/collections/a82ed90c5373e9f09125

One test case is failing,

I am storing the links as strings.

pm.collectionVariables.set("links", JSON.stringify(links))

When I test under google request, it’s passing:

pm.test("Links variable is an array", function () {
pm.expect(JSON.parse(pm.collectionVariables.get("links"))).to.be.an("array");

});

Of course I can edit the tests under “submit” request to make it pass. Please any explain me what I am doing wrong.

1 Like

Hi @bpricilla,

When I import your collection, the test under google request is also failing for the same reason:

This seems to be because your links collection variable is currently being saved as a comma separated string - i.e. https://www.instagram.com/etc,https://www.instagram.com/foo,...

The tests are expecting that you should save your collection variable formatted as an array - i.e. ["https://www.instagram.com/etc","https://www.instagram.com/foo",...]

@neilstudd Thanks for the response :slightly_smiling_face:

But I see that google request Tests are passing for me :exploding_head:

And I see the submit request is also passing now :stuck_out_tongue:

Sorry my bad, “Persist All” :stuck_out_tongue: it’s working now.

Anyway thanks a ton for replying :partying_face:

1 Like