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.

Both kinds of object maps can be edited 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. For a given name you can let the IDE look up that name and show the object in the Application Objects view using the Show In Application Objects button. This feature can be used to experiment with changes in the object names to verify that a changed name still finds the expected object.

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.

While an AUT is running

If an AUT is currently running, then it is possible to perform additional operations from the Object Map view.

Highlight Object

If the object can be found in the running AUT, clicking Highlight Object will cause a red outline to appear in the GUI of the running AUT, around the selected widget/control.

Check Existence

If the object can be found in the running AUT, a green checkmark is placed next to the entry. If no object can be found, then we will see a red "X". Note that the states of these checks and Xs are only updated if you select Check Existence again.

Show in Application Objects

If the object can be found in the running AUT, the object will be selected and highlighted for you in the Application Objects view.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results