What is a symbolic object name?

Last edited on

For most GUI toolkits, Squish identifies AUT objects by their properties. But rather than using all of an object's properties, Squish uses just those that are likely to be stable. For example, Squish won't normally use an object's x, y, coordinates since the object might be moved in the user interface without actually affecting the AUT's behavior. On the other hand, Squish will usually use a text or caption property since that is likely to remain the same.

Squish typically creates unique identifying names for AUT objects based on their properties. Such names are called real names or multi-property names, and have the form {"propertyName1": "propertyValue1", "propertyName2": "propertyValue2", ...}.

In recorded test scripts Squish identifies AUT objects using symbolic names. These are variables that contain a dictionary. The Squish Object Map is the script module that stores those definitions. The reason for the two naming schemes is to make it easier to maintain tests.

For example, if an AUT has an OK button, one of the properties that Squish will use to identify it is its text property with the text "OK". If the AUT's developers change the button's text to "Save", tests that access the button will now fail. It would be tedious and error prone to edit every single test that accesses this button: and it isn't necessary thanks to Squish's Object Map. All that we need to do is find the button's symbolic name in the Object Map and change the text property to the new text, i.e., "Save". Now all the tests will work again: and we didn't need to change a single line of code in any of the tests that access the button!

For example, instead of recording using a real name:

mouseClick({"type": "QPushButton", "text": "OK"})

Squish records using a symbolic name instead:

mouseClick(names.OK_Button)

and adds an entry to the Object Map which maps the symbolic name to the real name:

names.OK_Button{"type": "QPushButton", "text": "OK"}

Real names are always enclosed in braces whereas symbolic names always begin with a colon.

So, if the OK button's text is changed to "Save", just by editing the Object Map all tests that access the button will continue to work. After such an edit the Object Map's entry will look like this:

names.OK_Button{"type": "QPushButton", "text": "Save"}

When you write your own test scripts or edit recorded ones, it is normally best to use symbolic names so that you have the flexibility to change the properties in the Object Map without having to change your code. However, occasionally it can be useful to use real names, e.g., when creating names programmatically.

To view the Object Map click the Object Map toolbar button in the Test Suite view.

See also Object Map , Object Name Generation , Improving Object Identification , and Object Map view .