1 Test case failing in Student Expert Program

I am trying to complete the student expert program. I have completed all the units but when I try to share it using the final request i get this error.

Used query and path parameters | AssertionError: expected [] to have a length above 0 but got 0

can someone guide me where it maybe wrong?

Your best bet is to walk through each of the steps again and see if you’ve missed something along the way.

The failures relate to either path or query params so take a closer look at the scenarios that involve them.

Also, ensure that you have updated the Public Collection link so that it reflects all the current changes.

Tried doing both i cant find it.

What have you tried?

You might need to expand on your responses here, as you’re the only person that can see what’s in front of you :joy:

Did you update the shared link in the same place that it was created, before validating the collection again?

Can you show where you have set the query or path params in the course?

The DEL 4. Remove Match looks like it’s the one that uses a path variable, is that correct?

@danny-dainton I solved it. Indeed a silly mistake i was using query params instead of path. changed it and all test cases passed. Well, I do not see anything after passing the test. but [11/11] test cases passed am i ready to submit it?

If all the tests are now passing, it looks like you’re ready to submit the Collection link with the form.

Check the test which is present in the check progress > Test Collection.
pm.test(“Used query and path parameters”, () => {

//first folder should have query

let queryArr = requestArr.filter(value => value.request.url.query).map(value => value.request.url.query);

console.log(queryArr);

pm.expect(queryArr).to.have.length.of.above(0);

//first folder should also have path

let pathArr = requestArr.filter(value => value.request.url.path).map(value => value.request.url.path);

var pathParams = pathArr.flat().filter(p => p.startsWith(':')); 

console.log(pathParams);

//pm.expect(pathParams).to.have.length.of.above(0);

});

Try this your error will get Cleared

Hello!

I receive the same error:
“Used query and path parameters | AssertionError: expected to have a length above 0 but got 0”.

But, look in script, see in comments follow:
//first folder should have query:

  • in mi first folder, i have a url = “{{training_api}}/matches?status=pending” (query param on request Get matches);

“{{training_api}}/match?match_id=OAJPFOD8j” (query param on request Update score);

//first folder should also have path:

  • in mi first folder, i have a url = “{{training_api}}/match/z882LFszt” (path param on request Remove a match);

But, my test collection forever fail one test "Used query and path parameters ", how fix this?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.