Setting up attaching to running applications¶
STEP 1: Register and use your application in Squish¶
To avoid any hooking problems that are unrelated to attaching, make sure that you can record and replay with your application. To do this, the application has to be registered as a Mapped AUT
.
To do this via the Squish IDE:
Go to...
Edit
> Server Settings
> Manage AUTs...
> Mapped AUTs
...and add your application's .exe as a Mapped AUT
.
To do this via command line:
"C:\Squish\bin\squishserver" --config addAUT MyApplication "C:\Program Files\MyApplication 1.0"
At this point please try to record and replay a short test case to make sure that your application can be successfully started by Squish.
STEP 2: Register an attachable AUT¶
Before you can attach to a running instance of your application, an Attachable AUT
has to be registered.
This is not an actual application, but rather a name of your choosing that will later be used in attachToApplication(), and which stands for the host name/TCP/IP address and port number on which the actual application is listening for connections from Squish.
To do this via the Squish IDE:
Open...
Edit
> 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".
To do this via command line:
"C:\Squish\bin\squishserver" --config addAttachableAUT MyApplicationAttachable 127.0.0.1:9999
STEP 3: Start your application¶
(If your application is already running, but has not been started via Squish/startjavaaut.exe
, quit your application.
Start cmd.exe or a Unix shell.
In cmd.exe or the shell: Start your application via
<SQUISH_DIR>/bin/startjavaaut.exe
:
"C:\Squish\bin\startjavaaut" --verbose --port=9999 "--cwd=C:\Program Files\MyApplication 1.0" MyApplication
STEP 4: Create a new test script¶
def main():
attachToApplication("MyApplicationAttachable")
test.breakpoint()
STEP 5: Use "Record Snippet"¶
Execute to the breakpoint.
Start recording by opening the "Squish" menu and choose "Record Snippet". (If disabled click into the test script editor and check this menu entry again, it should be enabled now.)
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.
STEP 6: Execute test suite/test cases¶
To execute a test suite via command line:
"C:\Squish\bin\squishrunner" --testsuite C:\test_suites\suite_v1
To execute selected test cases via command line:
"C:\Squish\bin\squishrunner" --testsuite C:\test_suites\suite_v1 --testcase tst_case1 --testcase tst_case5
Troubleshooting¶
Make sure that you have started your application successfully with startjavaaut
.
Related information¶
- Attaching to Running Applications (Squish online manual)