New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environmental variable not updated #4197
Comments
Order of execution is
So, any variable set from req level pre-req script will not be available in the collection pre-req script |
the variable is updated at the end when you inspect it, but it seems that when the collection level pre request script runs some kind of snapshots of the variables is made and the update of the request pre request script change on the variable is not considered. |
Yes variable will be updated but because of the order of execution collection pre-req script cannot access it
|
here is an example- "try changing this value" - change this value in different requests create test variable( in the case global) testVariable Collection pre request scirpt
request pre req script
so 2 gives the updated value but logTheVariable(); gives us the old value. At the end the variable is updated and if you call run again 1 will give you the new value some kind of snapshot of the variables is made when collection pre req is called which i believe is a bug |
@ivaylogeorgiev1 I was able to reproduce this.
// Collection script
function logTheVariable () {
...
}
pm.variables.set('logTheVariable', logTheVariable.toString())
// Request script
eval(pm.variables.get('logTheVariable'))
logTheVariable() |
yes, this work around is clear to me but I'm still thinking that this is a bug. |
@harryi3t, you wrote:
Although it's not an intended feature, I think it's one that's desperately needed. Are there any plans to support it in the near future? I think definitions from the various scripts should cascade:
That is, code in script 𝒏 should be able to access definitions from scripts 1 through 𝒏. |
Hello,
I have pre-request script on collection level with a method (self invoked )that uses the environment variable X
On request level i have pre request script that updates the environment variable X
then I'm calling the method from the collection level pre -request script and the X is not updated.
Is that a bug ?
The text was updated successfully, but these errors were encountered: