7.5. Environment Variables

There are three separate environments that must be considered when testing AUTs:

For AUTs, we can easily add environment variables in the Settings view (Section 8.2.16)'s Environment section. In addition, the squishserver sets some environment variables that are visible to the AUT; for more about these see Setting Environment Variables (Section 7.3.3).

For the squishserver and the squishrunner, we can set the environment variables that influence them before running them. If we run them via the Squish IDE we must set the environment variables before starting the Squish IDE.

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 applicationContext.environmentVariable function; see Application Context (Section 6.3.12).

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 8.2.16)'s Environment section; see Setting Environment Variables for the AUT (Section 7.3.3.1) for more details.