Using Squish as a module in other Python scripts, applications

Skip to end of metadata
Go to start of metadata

Table of Contents


It is possible to automate user interfaces using the Squish API from existing Python scripts using a special Python module called squishtest.

Obtaining a Squish package with the correct Python configuration

The squishtest module functionality is available free of charge and is included in all Squish packages.

However, if you are using a Python installation with a different point-release (or architecture) from what is included in the Squish package, the Python module will not be compatible with your Python installation. In this case, you need a Squish package custom built with a Python version that matches your Python installation. To provide such a package we need the following from you::

  • The file <SQUISHDIR>/buildinfo.txt of your existing Squish package (if any; or information which Squish edition and configuration you want to use).
  • The exact Python version in which you plan to use squishtest module.
  • If your Python installation is configured for UCS-2 or UCS-4.

To determine the exact version and information about UCS-2 or UCS-4 please send us the output generated by running the following command:

Execute in a shell

Using the squishtest module in Python scripts

A simple Python script using squishtest might look like this:

NOTE: The value TOOLKIT_WRAPPER of the second parameter of squishtest.testSettings.setWrappersForApplication() must actually be one of these:

Squish edition TOOLKIT_WRAPPER Value
Squish for Android Android
Squish for Flex Flex
Squish for iOS iOS
Squish for Java Java
Squish for Mac Mac
Squish for Qt Qt
Squish for Tk Tk
Squish for Web Web
Squish for Windows Windows
Squish for XView XView

The above example test script and others like it can be executed with a plain Python interpreter, as long as the environment is configured correctly.
We can configure our command line shell environment for starting squishserver or running such python scripts using steps like those below.

On Unix: Execute in a shell/terminal

The PYTHONPATH is required to allow Python to see the squishtest module. The LD_LIBRARY_PATH is required to make the Unix system see the other libraries the squishtest module depends in (in the lib folder of the Squish package).

On Windows: Execute in cmd.exe

The first dir in PYTHONPATH is required to allow Python to see the squishtest module. The second is for 'import names' to work.

Related Information

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.