UFT Class 17
(Synchronization, Checkpoints Part-1)
Synchronization UFT with AUT
What is Synchronization?
UFT AUT
It is a process of matching the speeds of UFT tool and AUT, in order to get proper execution and Result.
Why Synchronization?
During Test execution UFT gives instructions one by one with same speed, but AUT takes less time for some steps execution
and more time for some steps execution, in order to keep them in sync then Synchronization is required.
When Synchronization is required?
UFT tool default Synchronization time is 20 seconds, if any step takes more than 20 seconds for execution then Synchronization is required.
Types of Synchronization
a) Conditional Synchronization
b) Unconditional Synchronization
How to Synchronize UFT and AUT?
a) Insert wait statement
Syntax:
Wait (Time in seconds) or Wait Time in seconds
Ex:
Wait (10)
Note: It is conditional Synchronization, waits maximum time eventhough operation is completed.
b) Insert Synchronization point
To insert Synchronization point, identify the Object and property on which we need to insert Synchronization point.
Ex:
“Delete Order” Button is Object
Enabled property
Syntax:
Object.WaitProperty “PropertyName”, Value, Time in milli seconds (Time is optional)
Note: It waits required time only.
Example:
Window(“Flight Reservation”).WinButton(“Delete Order”).WaitProperty “enabled”, True, 30000
Navigation:
Place cursor in desired location
> Select Record mode
> Design menu
> Synchronization point
> Show the object
> Select Property
> Enter Property value
> Set Time in mille seconds > OK
c) Increase Tool default time
Navigation:
File menu
> Settings
> Run
> Select Object synchronization Timeout
> Chang the value
> OK
————————————-
Note: If we increase tool default time, that settings applicable for all steps in that test.
d) Using Exist property
‘Exist property for Synchronization
SystemUtil.Run “C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe”,””,”C:\Program Files\HP\Unified Functional Testing\samples\flight\app\”,””
Dialog(“Login”).Activate
Dialog(“Login”).WinEdit(“Agent Name:”).Set “asdf”
Dialog(“Login”).WinEdit(“Password:”).SetSecure “54f7bb545b92f523dfa596ccfead0af7e4459d54”
Dialog(“Login”).WinButton(“OK”).Click
If Window(“Flight Reservation”).Exist(10) Then
Window(“Flight Reservation”).WinButton(“Button”).Click
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON”
Window(“Flight Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set “1”
Window(“Flight Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click
End If
——————————–
‘Exist property for Error Handling
If Not Dialog(“Login”).Exist(3) Then
SystemUtil.Run “C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe”,””,”C:\Program Files\HP\Unified Functional Testing\samples\flight\app\”,””
End If
Dialog(“Login”).Activate @@ hightlight id_;_1508758_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog(“Login”).WinEdit(“Agent Name:”).Set “asdf” @@ hightlight id_;_1181056_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog(“Login”).WinEdit(“Password:”).SetSecure “54f7bb545b92f523dfa596ccfead0af7e4459d54” @@ hightlight id_;_1705340_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog(“Login”).WinButton(“OK”).Click @@ hightlight id_;_1246642_;_script infofile_;_ZIP::ssf4.xml_;_
—————————————-
Select an appropriate method
———————————-
Advantages of Wait statement:
a) It won’t corrupt
b) No object reference is required
c) In order to observe the Test execution process then wait statement is the only solution
d) In order to capture screen shots during execution then wait statement is useful.
e) It can be used internally as well as externally
f) It is the only solution for Non-recordable steps.
——————————————————-
Note: UFT Tool default synchronization Time is only for Recordable Steps
It can’t be used for Non-recordable steps
Ex:
Window(“Flight Reservation”).Activate @@ hightlight id_;_984596_;_script infofile_;_ZIP::ssf1.xml_;_
Window(“Flight Reservation”).WinButton(“Button”).Click @@ hightlight id_;_1705442_;_script infofile_;_ZIP::ssf2.xml_;_
Window(“Flight Reservation”).Dialog(“Open Order”).WinCheckBox(“Order No.”).Set “ON” @@ hightlight id_;_3474724_;_script infofile_;_ZIP::ssf3.xml_;_
Window(“Flight Reservation”).Dialog(“Open Order”).WinEdit(“Edit”).Set “1” @@ hightlight id_;_1705398_;_script infofile_;_ZIP::ssf4.xml_;_
Window(“Flight Reservation”).Dialog(“Open Order”).WinButton(“OK”).Click @@ hightlight id_;_1508954_;_script infofile_;_ZIP::ssf5.xml_;_
Window(“Flight Reservation”).WinEdit(“Tickets:”).Set “5” @@ hightlight id_;_2884892_;_script infofile_;_ZIP::ssf7.xml_;_
Window(“Flight Reservation”).WinButton(“Update Order”).Click @@ hightlight id_;_656894_;_script infofile_;_ZIP::ssf8.xml_;_
Wait 9
Message = Window(“Flight Reservation”).ActiveX(“Threed Panel Control”).GetROProperty(“text”) @@ hightlight id_;__;_script infofile_;_ZIP::ssf9.xml_;_
If Message = “Update Done…” Then
Result = “Order Updated – Passed”
Else
Result = “Order Not Updated – Failed”
End If
Msgbox Result
Insert Checkpoints
What is Checkpoint?
It is a verification point, takes expected result from the User and compares with actual results during test execution and provides Test Result.
Expected Result: User (Tester)
Actual Result: During Test Execution
Test result: UFT provide test result after comparing expected with actual.
Types of Checkpoints
1) Standard Checkpoint
2) Text Checkpoint
3) Text area Checkpoint
4) Bitmap Checkpoint
5) Database Checkpoint
6) Accessibility Checkpoint
7) XML Checkpoint (From Resource)
8) XML Checkpoint (from Application)
9) File Content Checkpoint
10) Page Checkpoint
11) Image Checkpoint
12) Table Checkpoint