Squish tip of the week: Use environment variables in your scripts

Squish tip of the week: Use environment variables in your scripts

Did you know Squish Test Scripts have access to Environment Variables?

Environment variables can contain platform-specific information of value to your test scripts.

In Python for example, os.environ[“< env_var_name >“] returns a string value of the given environment variable. Each scripting language has its own variation.

Example getting PATH Environment Variable
import os

def main():
    msg = os.environ["PATH"]
    test.log("This system's PATH: " + msg)

function main() {
    var msg = OS.getenv("PATH");
    test.log("This system's PATH: " + msg);
}


Related articles using Environment Variables