Postman – Storing and Retrieving Numeric Values from Environment Variables

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:

  1. To store response time in environment variable, use setEnvironmentVariable function
  2. To retrieve the value from environment variable, use postman.<variable_name>
  3. To convert variable value to number for comparison, use Number() function

Leave a Reply

Your email address will not be published. Required fields are marked *