Synchronization in UFT

Synchronization in UFT

What is Synchronization?
It is a process of matching the speeds of two things

It is a process of matching the speeds of UFT and AUT in order to get proper execution and Result.

Why Synchronization?

During Test execution UFT gives instructions with same speed, but AUT takes less time for some statements execution
and more time for some statements execution, in order keep them in sync Synchronization is required.

When Synchronization is required?
If any statement takes more than 20 seconds there Synchronization is required.

How to Synchronize?

a) Insert wait statement (VBS)

    Syntax:

    Wait (Time in seconds)

    Example:

    Wait (10)

b) Insert Synchronization Point

Syntax:

   
Object.WaitProperty "Propert Name", Property value, Time in milli seconds

Example:

Window("Flight Reservation").WinButton("Delete Order").WaitProperty "enabled", True, 30000

c) Increase Tool default Synchronization Time
   
Exist Property with Conditional statements

'Exist property for Synchronization
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf" Dialog("Login").WinEdit("Password:").SetSecure "538fcbc06fe8e87f8642ce36e3ded44df14fe8cb" Dialog("Login").WinButton("OK").Click

If Window("Flight Reservation").Exist(10) Then
Window("Flight Reservation").Activate
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 General Error Handling
If Not Dialog("Login").Exist(3) Then
SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe
End If

Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf" Dialog("Login").WinEdit("Password:").SetSecure "538fcbc06fe8e87f8642ce36e3ded44df14fe8cb" Dialog("Login").WinButton("OK").Click

SystemUtil.Run "C:\Program Files\HP\Unified Functional Testing\samples\flight\app\flight4a.exe
Dialog("text:=Login", "index:=0").Activate
Dialog("text:=Login", "index:=0").WinEdit("attached text:=Agent Name:").Set "asdf" Dialog("text:=Login", "index:=0").WinEdit("attached text:=Password:").SetSecure "538fcbc06fe8e87f8642ce36e3ded44df14fe8cb"
Dialog("text:=Login", "index:=0").WinButton("text:=OK").Click


'Synchronization for Non-Recordable Statements
Window("Flight Reservation").Activate
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 Window("Flight Reservation").WinEdit("Tickets:").Set 2
Window("Flight Reservation").WinButton("Update Order").Click
Wait 9
Message = Window("Flight Reservation").ActiveX("Threed Panel Control").GetROProperty("text")

If Message = "Update Done..." Then
    Msgbox "Order Updated -Passed"
    Else
    Msgbox "Order Not Updated - Failed"
End If

Note: UFT can wait maximum 20 seconds for Recordable statements only.

Advantages of Wait statement

a) It won't corrupt

b) No object reference is required

c) It is the only solution for non-recordable statements

d) It is useful for capturing screen shots during execution

e) It is useful to observe the test execution process

f) It can be used internally and externally

0 comments:

Post a Comment