Overview¶
With Squish for Windows attaching to running applications can be done in two different ways:
Start the application outside of Squish, but with one of the Squish tools
Start one of the Squish tools and pass it the process ID of the already running application
Directly starting an application in attachable state¶
Start application with "<SQUISH_DIR>\bin\startwinaut.exe":
Here is the usage information for startwinaut
(from 6.2 and higher):
Usage: startwinaut [--port=<port>] [--cwd=<workingdir>] <command> <arg1> <arg2> ...
startwinaut [--port=<port>] --pid=<PID>
startwinaut [--port=<port>] --window-title=<window title>
(Also see startwinaut in the Squish manual.)
Example:
Step 1: Start AUT as an attachable AUT on a specific port:
(USERPROFILE and WINDIR are environment variables whose values are being inserted into the above command before execution by enclosing them in percent characters as shown above.)
Step 2: Register an "Attachable AUT" for the specific port in the Squish IDE
Step 2.1: In Squish IDE open menus Edit
> Server Settings
> Manage AUTs...
:
Step 2.2: Register an "Attachable AUT" by clicking on "Attachable AUTs" and the "Add" button; choose IP address / hostname of "localhost" (or "127.0.0.1") and a port number of your choice ("4444" for the rest of this article):
Step 3: Configure "No Application" in test suite settings:
Step 4: Start recording and choose the "Attachable AUT":
If you already have a test script (instead of recording a new one) you need to change the startApplication()
call in it to attachToApplication()
:
->
It is important to note that you must provide the name of an Attachable AUT to attachToApplication()
, as shown in Step 2 above.
Making an already running application attachable¶
Use "<SQUISH_DIR>\bin\startwinaut.exe" with the --pid or --window-title parameter:
startwinaut
help:
Usage: startwinaut [--port=<port>] [--cwd=<workingdir>] <command> <arg1> <arg2> ...
startwinaut [--port=<port>] --pid=<PID>
startwinaut [--port=<port>] --window-title=<window title>
(Also see startwinaut in the Squish manual.)
Example #1:
Example #2:
Please note that the process ID "3497" is just an example. You can look up the process ID of a application in Task Manager, or, more comfortably, in Process Explorer . (Also see Finding the process that a window belongs to .)
It is also possible to determine the PID at runtime, as described in Getting PIDs for window titles, executables on Windows .
Attaching to running applications in test scripts¶
The following example requires the helper script
squish_make_win_aut_attachable
.
Python¶
Related information: