Sunday, March 15, 2009

Dictionary Objects in QTP

Hi All ,
Here iam providing an overview on "Dictionary Objects" in QTP.

Using the Dictionary Object :
Usage of Dictionary Objects is an alternative to using environment variables to share values between actions. 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 .
Dim WshShell
Set WshShell =CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects\GlobalDictionary\ProgID", "Scripting.Dictionary","REG_SZ"
Set WshShell = Nothing
' After updating the registry, you must close and reopen QuickTest Professional.

‘Available methods for Dictionary Objects :
1) Exists:
Syntax :
GlobalDictionary.Exists() ' Returns True or False

2) Remove:
Syntax :
GlobalDictionary.Remove() ' Remove a specific key

3) RemoveAll:
Syntax :
GlobalDictionary.RemoveAll ' Removes all keys

4) Add:
Syntax :
GlobalDictionary.Add , ' Create a new key and assigns its value

5) Item:
GlobalDictionary.Item() ' Gets/Sets a key value

Have a nice day folks..........

No comments:

Post a Comment

Post a Comment