set and get environment variables
Set an environment variable
allowedMilliseconds
with value
100
pm.environment.set("allowedMilliseconds", 100);
Get the environment variable
pm.environment.get("allowedMilliseconds")
The environment variable in real use case. In this example response time is checked to be below 100ms
pm.test("Response time is less than "+pm.environment.get("allowedMilliseconds")+"ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(pm.environment.get("allowedMilliseconds"));
});
by Valeri Tandilashvili
4 years ago
Postman
test automation
0
Pro tip: use ```triple backticks around text``` to write in code fences