How do I read environment variables in Postman tests?

According to the docs here you can use

environment["foo"] OR environment.foo
globals["bar"] OR globals.bar

to access them.

ie;

postman.setEnvironmentVariable("foo", "bar");

tests["environment var foo = bar"] = environment.foo === "bar";

postman.setGlobalVariable("foobar", "1");

tests["global var foobar = true"] = globals.foobar == true;

postman.setGlobalVariable("bar", "0");

tests["global var bar = false"] = globals.bar == false;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)