Dictionary is used to store pairs of data and every pair
first value is called as Key and
second value is called as Item. To
access this dictionary pairs we can use an object called as dictionary object.
The corresponding dictionary object can create an interface
between QTP tool and a dictionary in memory (RAM). To create dictionary object
and access dictionary content using that object, we can use below code in
VBScript in QTP tool:
Option explicit
Dim dico
Set dico=CreateObject("Scripting.Dictionary")
In the above code createobject() function is used to create
an object for specified data structure. Here “dico” is an object for a
dictionary.
To store data into dictionary as pairs, dictionary object is
providing a function or method like shown below:
Option explicit
Dim dico
Set dico=CreateObject("Scripting.Dictionary")
dico.Add "English", 78
dico.Add "Hindi", 65
dico.Add "Maths", 98
dico.Add "Computers", 90
dico.Add "Physics", 80
No comments:
Post a Comment