Verify setting and using global variables in Postman
Preconditions (2)
Step 1: Open Postman and create a new request
Step 2: Set the request method to GET and the URL to https://postman-echo.com/get
Step 3: In the Pre-request Script tab, add code to set a global variable named 'token' with value '12345abcde'
Step 4: Send the request
Step 5: In the Tests tab, add code to verify that the global variable 'token' exists and its value is '12345abcde'
Step 6: Send the request again to execute the test script
Step 7: Open the Globals section in Postman to verify the variable 'token' is set with the correct value
✅ Expected Result: The global variable 'token' is set to '12345abcde' before the request, the test script confirms the variable exists with the correct value, and the Globals section shows the variable with the expected value.