16.6. Environment Variables

There are two different environments: The environment that the Squish tools (including test scripts) execute in, and the environment that the AUT executes in. Here we will consider the Squish environment; for more about the AUT's environment, see Setting Environment Variables (Section 16.4.3).

When a Squish starts up it reads the following environment variables (and uses default values for any that are not set):

Test scripts can access environment variables using the scripting-language-specific technique. For example, in Python, we can use home = os.environ["HOME"] (having done import os at the top of our script), and in JavaScript we can use var home = OS.getenv("HOME");. Test scripts can also access the AUT's environment by retrieving an ApplicationContext object and using the environmentVariable method; see Application Context (Section 16.1.3.10).

Squish also supports other environment variables, but unlike those shown above—which must be set before Squish is run (for example, by using a shell script or batch file to set them and then to run the Squish IDE)—the other environment variables can be set inside Squish using the Settings view (Section 17.2.13)'s Environment section; see Setting Environment Variables for the AUT (Section 16.4.3.1) for more details.

When running a test case, Squish sets the following environment variables in the AUT's environment:

Neither of these environment variables is available to test scripts (because test scripts execute in the Squish tools environment, not the AUT's environment). However, there is an exception: When squishrunner is used with the --testsuite option, both the AUT and the Squish tools environment (i.e., including test scripts) have SQUISH_TESTSUITE_NAME defined.