Day 5 - Submission is not checking the collection variables

https://www.postman.com/lunar-zodiac-759142/workspace/apeksha-inter/request/30118770-ea3f07ec-1903-4ed9-9f81-ebec0360297e

Hello,

Starting with day 7 and copy the folder and requests as per instructions , I noticed that my collection variables are not setting the values from getRequest. So further digging again for day 5 submission, I found that even my collection variables are not getting the values through get canadian request’s test tab.

My mistake was

pm.collectionVariables.set("FName", "FullName");
pm.collectionVariables.set("EId", "Email");
pm.collectionVariables.set("UUID", "Uuid");

i.e. (doubt quotes for value)
but my submission request was successful so like to notify postman team to plz check if it is an issue in submission test script.

Thanks…

Hey @apeksha-dalvi :wave:

The test script assertion uses .contains and I believe that’s not case sensitive so it would pass that test either way.

The test isn’t checking the datatype of that argument in the script.

pm.test("Collection variables set", () => {
    let canadianRequest = folder.item.find(req => { return req.name === "get Canadian user"})
    let canadianTest = canadianRequest.event.find(event => { return event.listen === "test" })
    pm.expect(canadianTest.listen).equals("test")
    pm.expect(canadianTest.script.exec.toString(), 'check collection variables set').contains("pm.collectionVariables.set")
    pm.expect(canadianTest.script.exec.toString(), 'check parsed name').contains("name")
    pm.expect(canadianTest.script.exec.toString(), 'check parsed email').contains("email")
    pm.expect(canadianTest.script.exec.toString(), 'check parsed uuid').contains("uuid")

    pass += 1
})

This is the corresponding test for day 5.

pm.test("Collection variables set", () => {
    let canadianRequest = folder.item.find(req => { return req.name === "get Canadian user"})
    let canadianTest = canadianRequest.event.find(event => { return event.listen === "test" })
    pm.expect(canadianTest.listen).equals("test")
    pm.expect(canadianTest.script.exec.toString(), 'check collection variables set').contains("pm.collectionVariables.set")
    pm.expect(canadianTest.script.exec.toString(), 'check parsed name').contains("name")
    pm.expect(canadianTest.script.exec.toString(), 'check parsed email').contains("email")
    pm.expect(canadianTest.script.exec.toString(), 'check parsed uuid').contains("uuid")

    pass += 1
})

The test is just checking that name, email and uuid appears in the test script, which technically it does as you have it in the value string. Ok, yes, technically you can argue this should have failed.

yes, because after submission if one check the collection variables values then it could display the incorrect ones, as in my case the values were, FullName, Email and Uuid. It would be really helpful if postman verify the values saved in collection variables are correct.
Thank you, Danny and Mike! The Postman community’s support has been invaluable, and it’s keeping my motivation high as I tackle daily challenges. Your assistance is greatly appreciated.

Closing the thread.

1 Like

This topic was automatically closed after 90 days. New replies are no longer allowed.