0
0
Postmantesting~10 mins

Why Postman is essential for API testing - Test Your Understanding

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

Complete the code to send a GET request in Postman.

Postman
pm.sendRequest({ url: [1], method: 'GET' }, function (err, res) { pm.expect(err).to.be.null; });
Drag options to blanks, or click blank then click option'
A'POST'
B'PUT'
C'https://api.example.com/data'
D'DELETE'
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTP methods instead of URL in the URL field.
2fill in blank
medium

Complete the code to check if the response status code is 200.

Postman
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
Drag options to blanks, or click blank then click option'
A301
B404
C500
D200
Attempts:
3 left
💡 Hint
Common Mistakes
Using error codes like 404 or 500 instead of 200.
3fill in blank
hard

Fix the error in the assertion to check if the response body contains the key 'userId'.

Postman
pm.test('Response has userId', function () { pm.expect(pm.response.json()).to.have.property([1]); });
Drag options to blanks, or click blank then click option'
A'userId'
Buserid
CuserId
Duser_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted property names causing syntax errors.
4fill in blank
hard

Fill both blanks to extract the 'name' from the JSON response and check if it equals 'John'.

Postman
const name = pm.response.json().[1];
pm.test('Name is John', function () { pm.expect(name).[2]('John'); });
Drag options to blanks, or click blank then click option'
Aname
Bto.equal
Cto.eql
Dusername
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong property names or incorrect assertion methods.
5fill in blank
hard

Fill all three blanks to create a test that checks if the response time is less than 500ms and the response has a header 'Content-Type' with value 'application/json'.

Postman
pm.test('Response time and header check', function () {
  pm.expect(pm.response.responseTime).[1](500);
  pm.expect(pm.response.headers.get([2])).[3]('application/json');
});
Drag options to blanks, or click blank then click option'
Ato.be.below
B'Content-Type'
Cto.equal
Dto.be.above
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong assertion methods or header names without quotes.