UFT can be extended with additional custom reserved objects. This is a feature that can be exploited to develop objects that are instantiated at the UFT's launch time, making the developer's work much more efficient and the code more concise. In this section, we will describe how to implement GlobalDictionary
, which is to be used for data sharing among different Actions
.
Proceed with the following steps:
regedit.exe
and press Enter.ReservedObjects
. It should appear at HKEY_CURRENT_USERSoftwareMercury InteractiveQuickTest ProfessionalMicTestReservedObjects
.GlobalDictionary
.ProgID
of type REG_SZ (string value). Assign it the value of Scripting.Dictionary
.UIName
of type REG_SZ (string value). Assign it the value of GlobalDic
.VisibleMode
of type REG_DWORD (32-bit value). Assign it the value of 2 (Hexadecimal: 0x00000002)
.Action
, type GlobalDic.
:As you can see, UFT now recognizes GlobalDic
in the same fashion as other reserved objects (for example, SystemUtil
). The GlobalDictionary
parameter (GlobalDic
is the UIName
we defined in the registry) is already loaded and available, and we also have autocomplete for the syntax of the object methods and properties.
UFT takes the definitions of the reserved objects to be loaded from the Windows registry at the ReservedObjects
key (as mentioned previously). We defined the progID
(the unique identifier for the COM object) as Scripting.Dictionary
, which is the UIName
to be recognized in the UFT editor, and assigned 2
to VisibleMode
(meaning that it should be visible). When UFT is launched, it loads our custom object, together with the other default objects, and it stays in memory until UFT is closed.