Migrating to the Scripted Object Map: Common conversion problems
The squishide
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.
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:
clickButton(waitForObject("{text='New' type='QToolButton' unnamed='1' visible='1' window=':Address Book_MainWindow'}"))
This is what the conversion would produce:
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:
clickButton(waitForObject({"text": "New", "type": "QToolButton", "unnamed": "1", "visible": "1", "window": names.address_Book_MainWindow}))
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:
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:
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.
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".
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.
© 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.