Describe the bug
I’d like to combine several variables.
I have a series of requests that GET information and I’d like to combine several of them to be used in a POST. However, when I concat the variables or otherwise try to use it, the result is a string of the variable names, and not their values. ex. {{Var1}} {{Var2}} {{Var3}}
To Reproduce
Steps to reproduce the behavior:
Collect several environment variables, these variables all work on their own and in different contexts. (Note: I’ve successfully used these variables separately, it’s combining them that is creating the problem)
In Pre-request Script add the variables: Option 1) let string = “{{Var1}}” + “{{Var2}}” or Option 2) using concat (note must have “” around variable otherwise I receive an error about the {}'s matching.
Check value of new string is updated correctly.
Sadness.
Expected behavior
I’d like to be able to add variables so that if Var1= A, Var2 = B and Var3 = C in a Pre-request Script or Tests I could set Var4 to be {{Var1}}+{{Var2}}+{{Var3}} and get “ABC” and not {{Var1}}{{Var2}}{{Var3}}
App information (please complete the following information):
You can access environment variables like so: {{Var1}} only on the Request path area and not in the test scripts. If you would like to access environment variables in a test script you would need to fetch the environment variable as so:
Var1 = pm.environment.get(“Var1”);