Utility Objects in UFT – User friendly Tech help
Meaning of Utility Objects:-
n
Utility objects are basically reserved keywords in UFT . This means their functionality is already defined in UFT compiler .For example in C language we used “Printf” function, whose meaning was defined in standard library of functions that were accessible by C program.
n
n
On the same tracks UFT provides lot of inbuilt utility objects whose functionality we can use at Runtime. These are not stored in object repository as objects.
n
Usage:-
n
Helps in retrieving or controlling UFT settings which can be used to modify the behavior of UFT at Runtime.
n
Some of the available Utility Objects:-
n
Datatable, Description, Dotnetfactory, Repository, RandomNumber, Environment
n
Example:-
n
We need to generate Random number at runtime which can used to test the functionality of our application with random set of dat.
n
Scenario:- We want to test the addition functionality, based on the random number
n
Solution: –We are going to use “RandomNumber” utility object.
n
‘Calling addition function
n
nDim iFirstField,iSecondField
n‘Assigning the random value between 1 and 100
niFirstField = RandomNumber(1,100)
n‘Assigning the random value between 100 and 10000
niSecondField = RandomNumber(100,10000)
n‘Function call
nfnAdd iFirstField,iSecondFieldn
npublic Function fnAdd(iFirstField,iSecondField)
n Dim iResult
n iResult = iFirstField + iSecondField
n msgbox (iResult)
nEnd function
Selecting Random value from WebList