Now that we have a test suite, we can record our first test: first
you have to create a new test case in the suite; choose
| (Ctrl+N).
The Squish IDE inserts a new test case into the tree with the cursor ready to
enter a name for the test case. Type eur_conversion
and press Return. This adds the test case with the name
tst_eur_conversion (Squish's convention for test case
naming is similar to the naming of test suites: it requires them to start
with the prefix tst_).
Creating a new test case not only adds the entry to the tree, but also creates an empty test script. You can open this test script in the editor by clicking on the test.py entry in the tree.
The Squish IDE should now look like:

Next, we start recording the test case: select the entry tst_eur_conversion and right-click it to open the context menu. Choose from the menu. Now the Squish IDE opens a dialog where you can choose certain recording options. The defaults are just fine for us, so press . The Squish IDE then minimizes itself to a window just containing recording controls and it starts the application under test, i.e. Four J's GDC. All actions you do in Four J's GDC are now recorded until you exit it.
For this test we just want to add 10 in the
field for the Euros and test that the calculated values are correct. So
after Four J's GDC we start the shortcut for the currency converter (we assume
that the shortcut is already added).
In the currency converter window we choose the
button in the menu and type
10 in the line edit for Euros. Pressing
calculates and displays the converted values into
US dollars and Yens.
Now quit the application: first we close the currency converter window and exit Four J's GDC with the button. The Squish IDE recognizes that you finished Four J's GDC and it shows its normal window again with the newly recorded script. The script looks like:
def main():
snooze(1.5)
waitForObject(":MonitorView.qt_central_widget.m_ShortcutsStartToolButton")
clickButton(":MonitorView.qt_central_widget.m_ShortcutsStartToolButton")
waitForObject(":Edit.screen..MenuAction_eur")
clickButton(":Edit.screen..MenuAction_eur")
waitForObject(":Edit.screen.Edit.FormField_eur")
type(":Edit.screen.Edit.FormField_eur", "10")
waitForObject(":Edit.screen..Action_accept")
clickButton(":Edit.screen..Action_accept")
waitForObject(":Edit.screen..")
sendEvent("QCloseEvent", ":Edit.screen..")
waitForObject(":MonitorView.qt_central_widget.m_ExitToolButton")
clickButton(":MonitorView.qt_central_widget.m_ExitToolButton")
Squish generates scripts that are human readable and that you can later edit and change to meet your needs. So let's take a look at some statements:
The | |
The | |
With the function |
![]() | Note |
|---|---|
Objects are addressed through names. Squish automatically generates names for objects. If the GUI changes or if you want to use more intuitive names, Squish supports the concept of object maps that allow a mapping from symbolic names to the real names. See Object Map (Section 16.9) for details on object maps. |
The recorded script is ready to be played back again. Click the
play button (
) and you can watch how Squish replays
the above script and repeats your input. But it actually doesn't test
anything yet. The next step is to add verification points to the script so
that it actually tests something.