7.15. Migrating to the Scripted Object Map: Common conversion problems

Table of Contents

7.15.1. Real Names that contain Symbolic Names
7.15.2. Custom functions that take Symbolic Names as parameters
7.15.3. Symbolic Names that use characters that need to be escaped in the script language

The Squish IDE offers a basic conversion wizard to convert test suites from the text based Object Map to the new script based Object Map. You can find this functionality in the Object Map section of the Test Suite Settings as well as in the top right corner of the Object Map Editor. The conversion is a very basic best-effort operation and is not guaranteed to produce a working Test Suite. Following are some common conversion problems.

7.15.1. Real Names that contain Symbolic Names

When test scripts use Real Names that contain Symbolic Names, the conversion will replace the Symbolic Names inside the Real Names with Scripted Symbolic Names, which will break the test script execution.

This is an example of code that would not get converted correctly:

Python
clickButton(waitForObject("{text='New' type='QToolButton' unnamed='1' visible='1' window=':Address Book_MainWindow'}"))

This is what the conversion would produce:

Python
clickButton(waitForObject("{text='New' type='QToolButton' unnamed='1' visible='1' window=names.address_Book_MainWindow}"))

To solve this issue the old Real Name can be converted to a Scripted Real Name manually:

Python
clickButton(waitForObject({"text": "New", "type": "QToolButton", "unnamed": "1", "visible": "1", "window": names.address_Book_MainWindow}))

7.15.2. Custom functions that take Symbolic Names as parameters

Existing test frameworks might already be using custom script objects to identify gui elements (e.g. when using page objects) and there might be convenience functions inside the test scripts that work with both Symbolic Names and custom script objects. Since the conversion will simply replace all Symbolic Names with Scripted Symbolic Names all custom functions that are used with Symbolic Names also need to support Scripted Symbolic Names or the test scripts will not execute correctly.

This is an example of code that might not get converted correctly:

Python
def customVerification(objectOrName):
    if isinstance(objectOrName,str):
        #do something with the symbolic name
    else:
        #do something else

def main():
    startApplication("addressbook")
    customVerification(":Address Book.New_QToolButton")

This is what the conversion would produce:

Python
def customVerification(objectOrName):
    if isinstance(objectOrName,str):
        #do something with the symbolic name
    else:
        #do something else

def main():
    startApplication("addressbook")
    customVerification(names.address_Book_New_QToolButton)

To solve this issue the function code needs to be adapted manually to be compatible with dictionaries that squish uses as scripted real names.

7.15.3. Symbolic Names that use characters that need to be escaped in the script language

When Symbolic Names contain characters that need to be escaped in the script language but not in the object map itself the name will simply not be replaced (e.g. the @ in Perl needs to be escaped, but not inside the object map).

This Perl code will not get converted because the object map entry will be “John.Doe@froglogic.com_Item”.

Perl
test::compare(waitForObject(":John.Doe\@froglogic.com_Item")->text, "John.Doe\@froglogic.com")

To solve this issue the names will have to be converted manually.