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 Kommentare

Eine Antwort hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*