0
0
Postmantesting~20 mins

Script execution order in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Script Execution Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Order of script execution in Postman

In Postman, when you send a request, scripts can run in different phases. Which of the following lists the correct order of script execution?

ARequest Sent → Pre-request Script → Tests Script
BPre-request Script → Request Sent → Tests Script
CTests Script → Pre-request Script → Request Sent
DPre-request Script → Tests Script → Request Sent
Attempts:
2 left
💡 Hint

Think about what needs to happen before the request is sent and what happens after.

Predict Output
intermediate
2:00remaining
Output of console logs in Postman scripts

Consider these Postman scripts attached to a request:

pm.test('Test 1', () => { console.log('Test script running'); });
pm.environment.set('var1', 'value1');

And the Pre-request Script:

console.log('Pre-request running');

What will be the order of console log outputs when the request is sent?

A
Pre-request running
Test script running
B
Test script running
Pre-request running
CTest script running only
DPre-request running only
Attempts:
2 left
💡 Hint

Remember when each script runs relative to the request.

assertion
advanced
2:00remaining
Correct assertion placement in Postman scripts

You want to check if the response status code is 200. Where should you place the assertion?

AIn the Pre-request Script
BIn the Post-request Script
CBefore sending the request
DIn the Tests Script
Attempts:
2 left
💡 Hint

Assertions check the response after it arrives.

🔧 Debug
advanced
2:00remaining
Debugging script execution order in Postman

You have a Pre-request Script and a Tests Script both logging messages. You notice the Tests Script logs appear before the Pre-request Script logs in the console. What is the most likely cause?

AThe console is showing logs from a previous request run
BPre-request Script runs after Tests Script by design
CThere is a syntax error in the Pre-request Script stopping it from running
DPostman runs Tests Script twice before Pre-request Script
Attempts:
2 left
💡 Hint

Think about how console logs accumulate in Postman.

framework
expert
2:00remaining
Custom script execution order in Postman Collection Runner

You run a collection with multiple requests in Postman Collection Runner. You want to run a script once before all requests and once after all requests. Where should you place these scripts?

AUse Environment Pre-request Script for before all, and Environment Tests Script for after all
BUse Pre-request Script in the first request and Tests Script in the last request
CUse Collection Pre-request Script for before all, and Collection Tests Script for after all
DUse Global Pre-request Script for before all, and Global Tests Script for after all
Attempts:
2 left
💡 Hint

Think about script scopes in Postman collections.