As an alternative to using environment variables to share values between actions, you can use the Dictionary object. The Dictionary object enables you to assign values to variables that are accessible from all actions (local and external) called in the test in which the Dictionary object is created.
'In order to have IntelliSense for the Dictionary object, and have it recognized by other actions, it is added to the registry
Set WshShell =CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects\GlobalDictionary\ProgID", "Scripting.Dictionary","REG_SZ"
' After updating the registry, you must close and reopen QuickTest Professional.
' ***********************************************************************************
' -----------------------------
GlobalDictionary.Exists(<Key Name>) ' Returns True or False
GlobalDictionary.Remove(<Key Name>) ' Remove a specific key
GlobalDictionary.RemoveAll ' Removes all keys
GlobalDictionary.Add <Key Name>, <Value> ' Create a new key and assigns its value
GlobalDictionary.Item(<Key Name>) ' Gets/Sets a key value
No comments:
Post a Comment