0
0
Postmantesting~10 mins

Monitor results analysis in Postman - Interactive Code Practice

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

Complete the code to check if the monitor run was successful.

Postman
pm.test('Monitor run status is successful', function () {
    pm.expect(pm.response.code).to.equal([1]);
});
Drag options to blanks, or click blank then click option'
A200
B404
C500
D301
Attempts:
3 left
💡 Hint
Common Mistakes
Using 404 or 500 which indicate errors instead of success.
Checking for redirect codes like 301 which are not success for this test.
2fill in blank
medium

Complete the code to assert the response time is less than 500 milliseconds.

Postman
pm.test('Response time is acceptable', function () {
    pm.expect(pm.response.responseTime).to.be.[1](500);
});
Drag options to blanks, or click blank then click option'
Abelow
Babove
ClessThan
DgreaterThan
Attempts:
3 left
💡 Hint
Common Mistakes
Using above or greaterThan which check the opposite.
Using below which is not a valid Chai assertion method.
3fill in blank
hard

Fix the error in the assertion to check if the JSON response has a 'success' property set to true.

Postman
pm.test('Response has success property true', function () {
    pm.expect(pm.response.json().[1]).to.eql(true);
});
Drag options to blanks, or click blank then click option'
Asuccess
Bstatus
Cresult
Dmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'status' or 'result' which may not be boolean true.
Using 'message' which is usually a string, not a boolean.
4fill in blank
hard

Fill both blanks to create a test that checks if the response body contains the word 'monitor' and the status code is 200.

Postman
pm.test('Response contains monitor and status is 200', function () {
    pm.expect(pm.response.text().[1]('monitor')).to.be.[2];
    pm.expect(pm.response.code).to.equal(200);
});
Drag options to blanks, or click blank then click option'
Aincludes
Btrue
Cfalse
DindexOf
Attempts:
3 left
💡 Hint
Common Mistakes
Using indexOf without comparing to -1.
Expecting false instead of true.
5fill in blank
hard

Fill all three blanks to write a test that checks if the JSON response has a 'data' object, the 'id' inside 'data' is greater than 0, and the status code is 200.

Postman
pm.test('Data object and valid id present', function () {
    const jsonData = pm.response.json();
    pm.expect(jsonData.[1]).to.be.an('object');
    pm.expect(jsonData.data.[2]).to.be.[3](0);
    pm.expect(pm.response.code).to.equal(200);
});
Drag options to blanks, or click blank then click option'
Adata
Bid
Cabove
Dlength
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'length' instead of 'above' for numeric comparison.
Checking wrong property names or types.