Hello all!
My question:
I would like to assign my variables, nothing more.
Details (like screenshots):
I do: Create a new request (there is no other place in the application to work in):
var uuid = require('uuid');
pm.collectionVariables.set("transactionId", uuid.v4().toString("B"));
console.log(pm.collectionVariables.get("transactionId"));
throw new Error("enough"); //read https://community.postman.com/t/stop-request-from-sending-if-pre-request-test-fails/
How I found the problem:
Collection variable retains old value. If this variable was not existing, this variable is not created.
The Console logs a new GUID always, but seemengly after throw, variables are reset to pre-run state.
What I tried else
I tried to specify urls:
GET https://example.com
GET https://httpstat.us/201
But it is slower, and I want to avoid bothering these folks with senseless calls.
What I want
Assign GUID to my variable to have it available through several sequential scripts.
Thank you!