Utility Objects
-->These are predefined by QTP which are used to enhancing scripting
Navigation: Insert Menu ->Step Generator -->Select Category as Utility Objects --> Find List of objects in Objects Drop Down
Utility Objects: -
Navigation: - Insert Menu -->Stepgenerator -->Select Category as Utility Object -->Find List of Utility
Objects in object drop down
Crypt: - It encrypts the given script generally it is used to enter Secure Password
Eg: - Crypt.Encrypt (“mercury”) [:- object. method]
--> We can also encrypt the given string with bellow navigation
Start --> all programs -->QTP-->Tools -->Password Encoder-->Enter the String -->Click Generate Button-->click Copy Button -->Paste it where needed.
Desktop: - It is used to work with desktop
***Note: -To click the radio button [Ex: - winRadioButton (“”).Set]
***Note: - To check the CheckBox we “ON”, “OFF” [Set “ON”/”OFF”]
To know whether CheckBox is checked are not go to spy check the Checked value as ON / OFF and assign
the value to GetROProperty
RandomNumber: - It is used to generate random number with given range
Example: -
1. Generate 4 digit random number
MsgBox RandomNumber (1000.9999)
2. Generate 5 Characters String
For index = 1 To 5
sStr = sStr & Chr(RandomNumber(65,90))
Next
MsgBox sStr
SystemUtil: - By using this we open and close application and its process during runtime
Run: -It is used to open application during runtime
Ex: - Open login Dialog
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
'Open internet explore
SystemUtil.Run "iexplore"
'Open internet explorer with URL
SystemUtil.Run "iexplore", "www.google.com"
'Open EXCEL
SystemUtil.Run "EXCEL"
'Open MS Word
SystemUtil.Run "WinWord"
CloseDescendentProcesses: - It closes all applications which are opened by QTP
Ex: -SystemUtil. CloseDescendentProcesses
CloseProcessByName: - It closes the given Process Name
Ex: -SystemUtil. CloseProcessByName ("EXCEL.EXE")
2. WaitProperty Method: -
3. Increase/ Decrease default Time Setting: -
-->When ever QTP not able to perform any statement then it will wait up to given default time.
Navigation: - File -->Setting -->Run -->Increase/ Decrease default time in object Synchronization time out field in seconds.
-->These are predefined by QTP which are used to enhancing scripting
Navigation: Insert Menu ->Step Generator -->Select Category as Utility Objects --> Find List of objects in Objects Drop Down
Utility Objects: -
Navigation: - Insert Menu -->Stepgenerator -->Select Category as Utility Object -->Find List of Utility
Objects in object drop down
Crypt: - It encrypts the given script generally it is used to enter Secure Password
Eg: - Crypt.Encrypt (“mercury”) [:- object. method]
--> We can also encrypt the given string with bellow navigation
Start --> all programs -->QTP-->Tools -->Password Encoder-->Enter the String -->Click Generate Button-->click Copy Button -->Paste it where needed.
Desktop: - It is used to work with desktop
***Note: -To click the radio button [Ex: - winRadioButton (“
***Note: - To check the CheckBox we “ON”, “OFF” [Set “ON”/”OFF”]
To know whether CheckBox is checked are not go to spy check the Checked value as ON / OFF and assign
the value to GetROProperty
RandomNumber: - It is used to generate random number with given range
Example: -
1. Generate 4 digit random number
MsgBox RandomNumber (1000.9999)
2. Generate 5 Characters String
For index = 1 To 5
sStr = sStr & Chr(RandomNumber(65,90))
Next
MsgBox sStr
SystemUtil: - By using this we open and close application and its process during runtime
Run: -It is used to open application during runtime
Ex: - Open login Dialog
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
'Open internet explore
SystemUtil.Run "iexplore"
'Open internet explorer with URL
SystemUtil.Run "iexplore", "www.google.com"
'Open EXCEL
SystemUtil.Run "EXCEL"
'Open MS Word
SystemUtil.Run "WinWord"
CloseDescendentProcesses: - It closes all applications which are opened by QTP
Ex: -SystemUtil. CloseDescendentProcesses
CloseProcessByName: - It closes the given Process Name
Ex: -SystemUtil. CloseProcessByName ("EXCEL.EXE")
Synchronization
-->It is a process of matching the execution speeds for both application and QTP
We can implement Synchronization in 4 ways
1. Wait() function
2. WaitProperty Method
3. Increase/ Decrease default time Setting
4. VB Scripting **
1. Wait Function: --->By using this function we can make to QTP wait in given time in seconds
-->It is a process of matching the execution speeds for both application and QTP
We can implement Synchronization in 4 ways
1. Wait() function
2. WaitProperty Method
3. Increase/ Decrease default time Setting
4. VB Scripting **
1. Wait Function: --->By using this function we can make to QTP wait in given time in seconds
-->It’s a static way
Limitations: - If given time is more than actual application time QTP still to wait, hence we have a
performance issue. If given time is less than actual application time than QTP does not wait and continues
to next step execution, hence we will get invalid results.
Syntax: - Wait (Time in Seconds)
Ex: - Wait (30)
Limitations: - If given time is more than actual application time QTP still to wait, hence we have a
performance issue. If given time is less than actual application time than QTP does not wait and continues
to next step execution, hence we will get invalid results.
Syntax: - Wait (Time in Seconds)
Ex: - Wait (30)
2. WaitProperty Method: -
->By using this we can apply synchronization on required object. To wait QTP for given time in milliseconds.
Syntax: -
Syntax: -
3. Increase/ Decrease default Time Setting: -
-->When ever QTP not able to perform any statement then it will wait up to given default time.
Navigation: - File -->Setting -->Run -->Increase/ Decrease default time in object Synchronization time out field in seconds.
4. VB Script: - ***
Example: -
Obj. WinButton (“Insert Order”).Click
While obj. WinButton (“Update Order”).GetROProperty (“enabled”) = “False”
Wend
iOrdNo = obj.WinEdit (“Order No”). GetROProperty (“text”)
MsgBox iOrdNo
[To know the execution time of use MercuryTimers in Utility Objects]
Example: -For Synchronization {for this we need Flight Reservation Application}
Example: -
Obj. WinButton (“Insert Order”).Click
While obj. WinButton (“Update Order”).GetROProperty (“enabled”) = “False”
Wend
iOrdNo = obj.WinEdit (“Order No”). GetROProperty (“text”)
MsgBox iOrdNo
[To know the execution time of use MercuryTimers in Utility Objects]
Example: -For Synchronization {for this we need Flight Reservation Application}
Chapter IX
Parameterization
Parameterization: - It is a process of replacing static values with dynamic values and executing test
scripts with multiple test data is called as parameterization.
--> We maintain test data and passing it to UT through QTP in bellow ways.
1. Data Table
2. Environment Variable
3. External Files [Ms-Excel, Notepad, Ms-Word, XML]
4. Action Parameters
Parameterization
Parameterization: - It is a process of replacing static values with dynamic values and executing test
scripts with multiple test data is called as parameterization.
--> We maintain test data and passing it to UT through QTP in bellow ways.
1. Data Table
2. Environment Variable
3. External Files [Ms-Excel, Notepad, Ms-Word, XML]
4. Action Parameters
No comments :
Post a Comment