0
0
Postmantesting~10 mins

Load testing basics (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 set the number of iterations for a Postman load test.

Postman
pm.environment.set('iterations', [1]);
Drag options to blanks, or click blank then click option'
A100
B'ten'
Ctrue
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a number for iterations.
2fill in blank
medium

Complete the code to check if the response status code is 200 in a Postman test script.

Postman
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
Drag options to blanks, or click blank then click option'
A404
B'200'
C200
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string '200' instead of number 200.
3fill in blank
hard

Fix the error in the Postman test script to correctly check if response time is less than 500ms.

Postman
pm.test('Response time is less than 500ms', function () { pm.expect(pm.response.responseTime [1] 500).to.be.true(); });
Drag options to blanks, or click blank then click option'
A>
B<
C==
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' or '>' instead of '<'.
4fill in blank
hard

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

Postman
pm.test('Body contains success and status is 200', function () { pm.expect(pm.response.text()).[1]('success'); pm.response.to.have.status([2]); });
Drag options to blanks, or click blank then click option'
Aincludes
B404
C200
DindexOf
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'indexOf' without comparison, or wrong status code.
5fill in blank
hard

Fill all three blanks to create a Postman test that checks if the JSON response has a 'status' key equal to 'ok', and the response time is less than 300ms.

Postman
pm.test('Status is ok and response time is fast', function () { const jsonData = pm.response.json(); pm.expect(jsonData.[1]).to.eql([2]); pm.expect(pm.response.responseTime [3] 300).to.be.true(); });
Drag options to blanks, or click blank then click option'
Astatus
B'ok'
C<
DresponseTime
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong key name, missing quotes around 'ok', or wrong operator for time.