I am a bit puzzled about how the environment variables are preserved between the monitor runs. So, I have a collection that contains a chain of requests, collects the JSON responses and stores some of the obtained IDs as environment variables at the end of the “Tests” stage of the requests:
pm.environment.unset("purchasedOrderId"); pm.environment.set("purchasedOrderId", jsonData.id);
Passing the environment variables works just fine within a single collection run performed by a Postman monitor. However, when I try to get environment variable value from the last run, I get the initial value stored into the environment configuration, just as every monitor run would start from scratch. That makes the precautions “if it failed last time, cancel last flow before continue any further” useless.
Am I missing something obvious here? Could that be a side effect of the fact that the environments are shared within the team?
Any ideas or suggestions are very much welcome!