I checked in Postman UI and confirmed that the variable is shared. It’s set up the same as other variables that seem to be working properly.
My newman command looks like: newman run Postman/smoke_testing.postman_collection.json -e https://api.getpostman.com/environments/${{ environment id }}?apikey=${{ api key }} --env-var url=${{ url }}
When I export the env file, the value is also exported successfully.
You are using the Postman API URL to reference the variables here but you also mentioned exporting a file. Where does the exported file come in, is that just for the Collection? Are the variables that are not working only at the Collection level or in different scopes?
Are the CI specific variables you have in that command resolving correctly?
How did you confirm that they are all shared? The variable experience has slightly changed so I wanted to check that you explicitly shared them from the variable scope.
There are many things here that we have zero visibility of so it’s tricky to know exactly what is happening without all the details.
In practice, we use the api url to pull down the variables, but I also exported the env collection json to see what that looked like and if it was storing the value. We don’t use the exported file during the test though; I was just checking in answer to your previous question.
Tests that run earlier in our suite use other environment variables and all other tests are able to use the shared values and get expected results. We also have assertions within our test’s post-scripts to check values in relevant cases. It seems to be just this one variable that isn’t sharing properly for us.
What changes have been made to the variable experience?
If it’s only just been added, it would be on the new experience in the UI. It would have to be explicitly shared, as in someone clicking the shared icon, for it to be available to something run outside of Postman.
The variable might be showing in the field and working in the Collection Runner but if it’s not be shared, it would work in GitHub.
You can shared a masked image of the line in the variable table of you want me it’s shared state?
Morning, unfortunately this variable still isn’t sharing in our CI runs
I did try exporting the env json and the value appears there, but for some reason this one value does not get shared when using the api url. Any other ideas?
Could you try adding in a Console Log statement to output the value from a Pre-request Script before it’s used to see if that resolves it console.log(pm.environment.get('var_name');
Are 100% sure that the variable name in the Collection matches the variable name in the file?
Does the CI tool output the variable syntax instead of the value?
Is there any change that you have a variable with the same name in a different scope that’s impacting it?
You could try and test it with a different Collection.
If you create a request using the Postman Echo service https://postman-echo.com/get?test={{var_name}} to see if that resolves it from the file.
I have added a console log before the test and unfortunately the output is completely blank. I was hoping that would have given some clarity but sadly not.
The full suite is working properly when run in the Postman UI, so I know for sure the variables are being called properly. Also confirmed in the Variables in request tab that I’m pulling down the correct value.
I’ve manually looked through, but I’ll add a second console log at the very top of the suite to see if I can narrow things down.