frmscoe / postman

Used for different rule testing and populating the arangodb
0 stars 0 forks source link

fix - updated Postman test to post stashed variables to global variab… #43

Closed Justus-at-Tazama closed 3 months ago

Justus-at-Tazama commented 3 months ago

…les instead of environment variables.

Postman contains two kinds of variables: there are environment variables and global variables. When you click the little icon in the top right in Postman, you'll get to see both of them. As a rule, the environment variables are just that - variables that define the parameters for running the Postman tests in our environment. These variables should be static/persistent between tests.

The global variables are the ones that should be used when you are stashing values between tests. For example, if you want to set up the address to the API, it's an environment variable. If you want to remember an ID from one test to use as input into another test, it's a global. No Postman test (prerequest script or test) should ever use the pm.environment.set("key", "value") method.

The purpose of this change is to refactor our existing Postman tests to use pm.globals.set() instead of pm.environment.set().

Acceptance criteria

Justus-at-Tazama commented 3 months ago

Regression testing on ArangoDB Setup collection:

image

Justus-at-Tazama commented 3 months ago

Confirmed there are no instances of pm.environment.get() in non-legacy tests that are attempting to retrieve a variable that is not in the environment file.

image