Saturday, November 22, 2014

Dictionary Objects in QTP ?

What are Dictionary Objects?
They store information in name/value pair.
How these are Different from Arrays?
Look like similar to Array but the difference is
1. Keys are used to identify the items in a dictionary object.
2. No need to call ReDim to chnge the Size.
3. When deleting an item from Dictionary, remaining items will automatically shift up.
4. They can’t be multi-dimensional.
Ilustration with an Example
Let’s understand the concept with an example:
Dim Dict
Set Dict = Server.CreateObject (“ Scripting Dictionary”)
Dict.Add “book1”, “Gandhi”
Dict.Add “book2”, “Nehru”
Dict.Add “book3”, “Indira”
Response.Write (“The book 2 is:” &Dict.item(“book2”))
Output: The book 2 is Nehru
Dictionary Objects
Properties: Compare Mode, Count, Item & Key.
Methods: Add, Exists & items.

No comments:

Post a Comment