0
0
Postmantesting~10 mins

Response size 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 the response size in Postman.

Postman
pm.test('Response size is less than 2KB', function () {
    pm.expect(pm.response.size().bodySize).to.be.[1](2048);
});
Drag options to blanks, or click blank then click option'
AlessThan
Bbelow
CgreaterThan
Dabove
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'above' or 'greaterThan' which check for larger values.
2fill in blank
medium

Complete the code to assert the response size equals exactly 500 bytes.

Postman
pm.test('Response size equals 500 bytes', () => {
    pm.expect(pm.response.size().bodySize).to.equal([1]);
});
Drag options to blanks, or click blank then click option'
A500
B1024
C2048
D256
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong number for the expected size.
Using a method other than equal for exact match.
3fill in blank
hard

Fix the error in the code to correctly assert the response size is greater than 1KB.

Postman
pm.test('Response size is greater than 1KB', function() {
    pm.expect(pm.response.size().bodySize).to.be.[1](1024);
});
Drag options to blanks, or click blank then click option'
Abelow
Babove
ClessThan
Dequal
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'lessThan' or 'below' which check for smaller values.
Using 'equal' which checks for exact match.
4fill in blank
hard

Fill both blanks to assert the response size is between 1KB and 3KB.

Postman
pm.test('Response size is between 1KB and 3KB', () => {
    pm.expect(pm.response.size().bodySize).to.be.[1](1024).and.[2](3072);
});
Drag options to blanks, or click blank then click option'
Aabove
Bbelow
ClessThan
DgreaterThan
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up above and below.
5fill in blank
hard

Fill all three blanks to create a test that asserts the response size is not equal to 0 and less than 5KB.

Postman
pm.test('Response size is valid', () => {
    pm.expect(pm.response.size().bodySize).to.not.[1](0).and.[2]([3]);
});
Drag options to blanks, or click blank then click option'
Aequal
BlessThan
C5120
Dabove
Attempts:
3 left
💡 Hint
Common Mistakes
Using above instead of lessThan for the second assertion.
Using wrong numbers for the size limit.