Object Map

The Object Map view is not shown in any perspective by default. To open it, click Object Map ({} ) in the Test Suites view. Or right-click a symbolic name in a test case, and select Open Symbolic Name.

In the Object Map view, you can rename, add, edit, and delete entries from the test suite's test- or script-based object maps.

{}

The Object Map view

Storing object names

Script-based object maps are stored in names.ext in the shared/scripts directory of the test suite.

Text-based object maps are stored in a plain text file called objects.map in the test suite's root directory. You can edit them in the Object Map view, a script editor, a plain text editor, or a code editor in Squish IDE.

Symbolic and real names

Symbolic Names shows the AUT's symbolic names, which Squish uses when it records test scripts. The names are shown in a hierarchy that you can expand to find a particular entry. Use symbolic names wherever possible because they make it easier for you to adapt to changes in the AUT without being forced to change the test scripts themselves.

Real Name shows the value, which is usually a set of properties associated with the highlighted symbolic name.

In the screenshot, the highlighted symbolic name is address_Book_MyAddresses_adr_File_QTableWidget. In its properties, you can see its real (multi-property) name: {"aboveWidget": address_Book_MyAddresses_adr_File_QToolBar, "type": "QTableWidget", "unnamed": 1, "visible": 1, "window": address_Book_MyAddresses_adr_MainWindow}. If the AUT's developers decided to use a QTableWidget subclass, such as EnhancedTableWidget, all the test scripts that use the widget would break. To fix this, you could change the type property's value to the new class name.

Note: You cannot undo the changes you make in the Object Map view. Before you delete or edit entries, take a backup of the test suite's objects.map file. If you accidentally delete a symbolic name, for example, click the view's close button (X), and then click the No button when prompted to save changes to the object map. This reverts all the changes you made.

Renaming objects

Double-click a symbolic name to edit it. For script-based object maps, a refactoring operation renames the variable in all test cases of your test suite after you save the changes.

Editing object properties

You can edit an entry's properties. For example, you might have an object with a windowTitle property whose value is Address Book - Untitled, but it changes over time. Squish detects this and creates a new symbolic name for each value. To use one symbolic name for all the values, make the entry more general by removing or editing its windowTitle property. Set the operator to Wildcard and the value to Address Book*, to make the entry match the window title when you open files. For more information about matching object names, see Improving Object Identification.

Removing symbolic names

To remove existing symbolic names, select them in Symbolic Names and click the Remove button. Keep in mind that you cannot undo the changes, and use this feature with care.

Creating symbolic names

To create a completely new symbolic name, click the New button in Symbolic Names. This creates a new symbolic name with the default name New and without properties.

Double-click the name to make it editable, and then change the name to something that makes sense for your test suite. To add new properties, click the New button in Real Name. To set the name and value of a property, double-click a cell and enter the name or value.

To set the operator, double-click it in the Operator column and use the up and down arrows to select the operator. For GUI toolkits, except Squish for Windows and Squish for Web, every real name should have a type property, so make sure to add this property and set its value to the name of the object's type. Usually, it is best to set at least two properties to ensure that the object is uniquely identified.

To delete properties, select them in Real Name and click the Remove button. Keep in mind that you cannot undo the changes, and use this feature with care.

Some buttons are only enabled while the AUT is running. If the AUT's GUI changes, you can find the object that a symbolic name refers to by selecting the name and clicking the Check Existence button. If it is not found, a red x appears. If it is found, a green check mark appears, and you can click Highlight Object to show it in your GUI with a transparent red rectangle over it.

The Object Map view context menu contains some standard editing actions, such as Copy, Cut, Paste, and Delete. The Copy action copies the selected symbolic name to the clipboard. To copy the real (multi-property) name, select the Copy Real Name option.

Some AUTs have lots of symbolic names. To find a specific object, type some part of its name in the filter field. For example, to find a particular button, enter the button's class name (e.g., Button). The list of symbolic names will be narrowed down to all those which contain the text Button.

For information about handling the object map programmatically in test scripts, see Object Map Functions. For more information about object maps in use, see Object Map.