Background
I have a variable in postman and i randomly generate an uid for creating a userid for signup and login test.
Work Done in Postman
In signup Request, on the pre-request script
var uid="{{$randomInt}}"
postman.setGlobalVariable("IID",uid);`
In Login Request, body is set to :
{"uid":"{{IID}}" }
Issue
The issue is everytime {{IID}} is executed,a new value is generated.
However,my motto is to create a userid randomly on signup and use it during
login,which fails as {{IID}} gives me a new uid ,instead of uid set
during Signup(using postman.setGlobalVariable("IID",uid);).
Query
Any ideas ,how to everytime randomly generate userid on start of flow and then use that userid in rest of flows in POSTMAN.
Flow is SignUp action followed by Login action.
Just use any library available in sandbox mode to generate random ID in pre-request script.
You can even make postman.setGlobalVariable("IID", Math.floor(Math.random() * 100));
or use lodash's _.random(min, max) for such purposes.
Everything else will work without changes(I mean "{{ID}}" in next requests' body/headers/URL)