Sharing the Scripted Object Map

Sharing the Scripted Object Map

Often, we are asked whether the scripted object map file can be shared between multiple test suites by moving the names.py file to a global scripts folder (the extension of names varies depending on the scripting language in use).

For technical reasons, the default location of the names.py file, which is in the C:\suite\shared\scripts subdirectory of a test suite (e.g., on Windows), cannot be changed. Instead, it is possible to include other files in the names.py file which in turn can be used to share a Script-based Object Map between test suites. This is explained with the help of an example below:

Each script you want to include in your Script-based Object Map, in order to share it between multiple suites, should be in a global scripts folder. Assuming there is a script file named common.py in a global scripts folder, simply include the global script files at the beginning of the Script-based Object Map as shown below:

Contents of the names.py file:

# encoding: UTF-8
from objectmaphelper import *
from common import *

Contents of the common.py file:

# encoding: UTF-8
from objectmaphelper import *
address_Book_MainWindow = {"type": "MainWindow", "unnamed": 1, "visible": 1, "windowTitle": "Address Book"}
address_Book_File_QToolBar = {"type": "QToolBar", "unnamed": 1, "visible": 1, "window": address_Book_MainWindow, "windowTitle": "File"}
address_Book_File_QTableWidget = {"aboveWidget": address_Book_File_QToolBar, "type": "QTableWidget", "unnamed": 1, "visible": 1, "window": address_Book_MainWindow}

Contents of the test.py file:

import names
def main():
    startApplication("addressbook")
    ...

2 Comments

  1. Dan 4 months ago

    How can the Warning message below be fixed or suppressed?
    squishrunner: Warning, couldn’t determine scripted object map path. Testsuite couldn’t be located.

    • Author
      Neha Bhatt 4 months ago

      Hello Dan,
      I am not able to reproduce this issue at my end. In order for me to be able to investigate further could you please create a new Test Suite, record a test case with minimum steps to reproduce the issue. Reproduce the issue and then send us the Squish Support Info in an email to squish@froglogic.com (you can get it from the Squish IDE by choosing Help > Collect Support Information). Also, zip the entire Test Suite and send that as well. We will get back to you as soon as possible.

Leave a reply

Your email address will not be published. Required fields are marked *

*