Testing :id routes

Testing :id routes

How can I test routes with :id into it.

For example, we have suppose a route like this

Router.get('/:id/profile

Now, I want to do a test case, the example scenario I saw from someone’s else code was that he was passing a string of numbers (probably user ID or something)

Being a total tester in beginner who have been asked to test something, how can I find that string which I can send when testing something.

For example here

describe('Admin users API testing', () => {
it('GET /admin/users/:id/activityLog', (done) => {
request(URL)
.get('/admin/users/5a82b1a61dab4b54fj01f212e/activityLog')
.set('accept', '/application/json')

We are sending request to

it('GET /admin/users/:id/activityLog

Which then looks like this

.get('/admin/users/5a82b1a61dab4b54fj01f212e/activityLog')

inside the above get request we have, something like this

5a82b1a61dab4b54fj01f212e

So my question is how do the person doing testing knows this?

By clicking “Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

發表留言