Variables Scope:
– Global Variables: Broad scope across workspace; ideal for testing.
– Collection Variables: Scoped to a collection; independent of environments.
– Environment Variables: Scoped to different environments; enables role-based access.
– Data Variables: Derived from external files for collection runs.
– Local Variables: Temporary, request-specific; cease after execution.
Global Variables:
– Setting: pm.globals.set(‘varKey’, varValue);
– Getting: pm .globals.get(‘varKey’’);
– Remove: pm.globals.unset(‘varKey’’);
– Remove all global variables: pm.globals.clear();
Collection Variables:
– Setting: pm.collectionVariables.set(‘varKey’, varValue););
– Getting: pm.collectionVariables.get(‘varKey’);
– Remove: pm.collectionVariables.unset(‘varKey’);
Environment Variables:
– Setting: pm.environment.set(‘varKey’, varValue););
-Getting: pm.environment.get(‘varKey’);
– Remove: pm.environment.unset(‘varKey’);
– Remove all env variables: pm.environment.clear();
Free Postman Tutorial:
Hindi: https://www.youtube.com/watch?v=OtNrpA1UYt4&list=PLuqnSAN_m8K2AEiIF84dyOo1L0OXfY6l2
English: https://www.youtube.com/watch?v=0pnL5NsHM9w&list=PLuqnSAN_m8K0Q4M3g9BQQplLh5vt17a3V