Return to site

Postman collection variables vs environment

broken image
broken image
broken image

Hence I need to fallback to using dynamic variables. The reason why I am doing this is because a data file is not available when I am just running an individual request, and not the entire collection via postman UI or Newman. Environment variables are specific to an environment and are accessible to all requests within that environment. I was hoping there is a way to determine via script if a data file is in use so I could avoid this manual setup. Environment Variable: If a variable with the same name is not found as a runtime/local variable, Postman will look for an environment variable. I am using a collection variable “ use_datafile” in the if condition, which I have to set manually each time I want to toggle between using a data file vs. 19 I've seen the postman doc about environments: where an image expresses that the enviornments are local to a collection, which I'm not seeing that happens in my Postman. Below is a snippet of the code to give more context: if (pm.collectionVariables.get('use_datafile') = 'true') ')) If a variable is unset, mc moves to the next variable. Collection variables at the collection level. However, what I wanted to find out is if there is a way to know via a script if an iteration data file is being used in a particular run. For Windows, mc attempts to construct a default file path by trying specific environment variables. In this module, you will learn how to: Create and set variables at multiple scopes: Global variables at workspace level.

broken image