It is possible to automate user interfaces using the Squish API from existing Python scripts using a special Python module called squishtest.
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 <SQUISH_DIR>/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:
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|
When the PYTHONPATH environment variable is configured correctly, and squishserver has been started (Unix: squish-dir/squishserver --verbose, Windows: C:\squish-dir\squishserver --verbose), the above test script can be executed with a plain Python interpreter:
The first "export" is required to allow Python to see the squishtest module.
The second "export" is required to make the Unix system see the other libraries the squishtest module depends in (in the lib folder of the Squish package).
Adding to PYTHONPATH is required to allow Python to see the squishtest module.
- Using Squish Functions in Python Modules/Packages (Squish Manual)
- Article - Using Squish functions in your own Python modules or packages (kb article)