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")
    ...
Neha was born in Kashmir, India and grew up in Kashmir and New Delhi. She did her diploma in computer science at C-DAC (Center of Diploma in Advance Computing), New Delhi, and worked for IBM India as a software developer until she moved to Germany in 2006.

4 Comments

  1. Dan 2 years 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 2 years 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.

  2. Chris Pella 12 months ago

    We are seeing the same issue. We are running our tests from another test runner but are using squishtest.pyd so we don’t have a Test Suite that we run through the IDE. This warning message is happening hundreds of times and creating a lot of noise in our logs.

    • Author
      Neha 12 months ago

      Hello Chris,
      Could you please open a ticket regarding this issue by sending an email to squish@froglogic.com. Also, send us the version of Squish package in use at your end.

Leave a reply

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

*