What is a symbolic object name?

Skip to end of metadata
Go to start of metadata

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 short strings that begin with a colon. The Squish Object Map relates every symbolic name to a real name. 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:

Squish records using a symbolic name instead:

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

: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:

:OK_Button → {type='QPushButton' text='Save'}

When you write your own test scripts or edit recorded ones, it is normaly 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 in the Tool Reference Manual. In addition, the User Guide has examples showing how to create names programmatically for some toolkits.

Labels:
property property Delete
symbolic symbolic Delete
name name Delete
object object Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.