If you are using Postman for your API testing and if you want to store and retrieve numeric values from environment variables, then here is a simple trick – use “Number” function. Let me explain the problem and solution.
Problem: I want to store numeric value in environment variable, for example – response time, then I want to retrieve the value from this environment variable and use for comparison.
Solution:
- To store response time in environment variable, use setEnvironmentVariable function
- To retrieve the value from environment variable, use postman.<variable_name>
- To convert variable value to number for comparison, use Number() function