How do object properties nest?

Last edited on

It can be useful to know how to nest one object name inside another

Real (multi-property) object names are of this form:

{"propertyName1": "propertyValue1", "propertyName2": "propertyValue2"}

If a property's value is another object name, then that name can simply be copied, either as a real name or as a symbolic name.

Nesting a real name:

{"propertyName1": "propertyValue1", "propertyName2": {"propertyName1": "propertyValue1",
"propertyName2": "propertyValue2"}}

Nesting a symbolic name:

{"propertyName1": "propertyValue1", "propertyName2": names.other_Object}

Here is an example based on an actual test suite's Object Map:

{"title": "Edit", "type": "QMenu", "unnamed": 1, "visible": 1,
"window": {"type": "MainWindow", "unnamed": 1, "visible": 1, "windowTitle": "Address Book"}}

This uses the Qt GUI toolkit, but the same principle applies to all toolkits.

Note that when Squish records tests, for objects that have other objects as property values, Squish uses symbolic rather than real names since these are shorter and more robust. So, the above would be recorded by Squish as:

{"title": "Edit", "type": "QMenu", "unnamed": 1, "visible": 1, "window": names.AddressBook_MainWindow}