I can’t figure out why this test case is failing
Hey @milindrai
What are you actually sending - What does the Postman console show?
Have you previous set that environment variable? Is there a value set in both the current and initial values?
Yes, I have set the environment variable…
the initial value of page variable is 0 and the current value is 405.
The test would be checking that the initial
is above one but I think it might have to do with the scope of variable you’re using - Have you tried using either a Global or Collection level variable for the request?
I tried the all three variable types and also taking and checking that the initial value should be greater than 1…but still it’s failing.
This challenge looks like its missing some steps/documentation.
This is the failing test.
pm.test("Page is correct", () => {
let submitRequest = collection.item[1].item.find(req => { return req.name === "submit"})
pm.expect(submitRequest.request.url.query[0].key, 'check key value').to.equal("page")
pm.expect(parseInt(submitRequest.request.url.query[0].value), 'check param value').to.be.above(0)
pass += 1
})
It’s expecting a query parameter on the “submit” request called “page”.
Its the value of this query parameter that needs to be above zero.
It’s not related to the collection/environment variables related to page from the main request.
It’s currently failing with “undefined” because you probably haven’t set it yet.
However, I can’t find anywhere in the documentation that tells you that you need to create this.
It does say this in the main documentation.
Run the collection:
- Run the collection or folder in the runner
- Make a note of the last call that runs in the collection - the one with the failed test. You will need that page number for an extra step on the solution for this challenge.
@danny-dainton It’s this extra step that appears to be missing from the documentation.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.