Setting up attaching to running applications¶
Step 1 - Register an attachable AUT¶
Before you can attach to a running instance of your application, you first need to register an "Attachable AUT" for where the application will be listening for Squish to connect to it.
In the Squish IDE:
Server Settings >
Manage AUTs... >
Attachable AUTs to register an "Attachable AUT", for example with the name "MyApplicationAttachable", with the host "127.0.0.1" and port "9999".
In command line: Enter the bin directory in your Squish Installation in a terminal or shell.
(Use a different host name or IP address and port numbers as required, for example the IP address of a remote computer or remote device if you plan to attach to an application running there.)
Step 2 - Start the application¶
On desktop operating systems or embedded/other devices:
Enter the bin directory in your Squish Installation in a terminal or shell; this is the same folder where the squishserver and a squishqtwrapper library can be found.
Start your application via the
startauttool, replace PATH_TO_APPLICATION as needed with the path to the application binary
If you are starting your application through a shell script of any kind the startaut tool must start the real application binary and not the script.
On non-desktop operating systems (Squish hook built into the application):
Android, iOS: Start the application yourself.
iOS: Start the application via Apple's
instruments(included in Xcode).
Android: Start the application via
adb(included in Squish for Android and Android SDK).
Step 3 - Create a new test script¶
Step 4 - Use "Record Snippet"¶
To record on an attachable AUT you can either record a full testscript or record Snippets. For the latter you must first have the IDE be in a brakepoint. After that follow the steps below.
Start recording by opening the "Squish" menu and choose "Record Snippet".
To end the recording and insert the recorded snippet choose "Stop Recording" on the Squish Control Bar, and then, back in the Squish IDE, terminate the current script execution.
When the application is started via startaut with the
--verbose you should see the following messages in the output from startaut, the parts in single quotes are placeholders that may differ depending on your setup :
Listening on port 'CHOSEN_PORT' for incoming connections
Finished initializing Squish Qt toolkit support for AUT 'AUT_NAME'
If those messages are not present or you get an error message like this in the test results
connection to AUT refused it can be useful to check if there is any process listening on the network port you provided with the --port argument to startaut at all.
This can done through any third party tool that can open a newtork connection and also through the Python Interpreter in Squish