0
0
Postmantesting~10 mins

Why mocking enables parallel development in Postman - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a mock server in Postman.

Postman
pm.mockServer.create([1]: 'My Mock Server'});
Drag options to blanks, or click blank then click option'
Aname
Burl
Cmethod
Dresponse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'url' instead of 'name' causes an error.
Confusing 'method' with server creation property.
2fill in blank
medium

Complete the code to define a mock response for a GET request.

Postman
pm.mockServer.addMockResponse({ method: 'GET', [1]: '/users', response: { status: 200, body: '{}' } });
Drag options to blanks, or click blank then click option'
Apath
Burl
Cendpoint
Droute
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'url' instead of 'path' causes the mock to not match requests.
Confusing 'endpoint' with the property name.
3fill in blank
hard

Fix the error in the mock response code to enable parallel development.

Postman
pm.mockServer.addMockResponse({ method: 'POST', path: '/login', response: { status: 200, body: [1] } });
Drag options to blanks, or click blank then click option'
Atoken: 'abc123'
B{token: 'abc123'}
C'token: abc123'
D'{"token": "abc123"}'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing an object instead of a JSON string causes runtime errors.
Missing quotes around the JSON string.
4fill in blank
hard

Fill both blanks to create a mock server and add a mock response for GET /products.

Postman
const mockServer = pm.mockServer.[1]([2]: 'Product Mock Server'});
mockServer.addMockResponse({ method: 'GET', path: '/products', response: { status: 200, body: '{}' } });
Drag options to blanks, or click blank then click option'
Acreate
Bname
Cstart
Durl
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'create' causes errors.
Using 'url' instead of 'name' for server creation.
5fill in blank
hard

Fill all three blanks to define a mock response with status 404 and a JSON error message.

Postman
mockServer.addMockResponse({ method: [1], path: [2], response: { status: [3], body: '{"error": "Not Found"}' } });
Drag options to blanks, or click blank then click option'
A'GET'
B'/unknown'
C404
D'POST'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong method string causes mock mismatch.
Incorrect status code changes the test meaning.