Using Squish as a module in other Python scripts, applications

Skip to end of metadata
Go to start of metadata

Table of Contents

Overview

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 <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:

Execute in a shell

Using the squishtest module in Python scripts

A simple Python script using squishtest might look like this:

myscript.py

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:

On Unix: Execute in a shell/terminal

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).

On Windows: Execute in cmd.exe

Adding to PYTHONPATH is required to allow Python to see the squishtest module.

Related Information

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