Synchronization in UFT

Synchronization in UFT
----------------
What is Synchronization?

Why Synchronization?

When Synchronization is required?

How to Synchronize?

    Insert Wait statement (VBS)

    Wait (Time in seconds) / Wait Time in seconds

    Ex: Wait (17)

    Insert Synchronization point (UFT)

Syntax:

Object.WaitProperty "PropertyName", property value, Time in milli seconds

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

    Increase Tool default Time (UFT)

Select appropriate method
--------------------------------------
'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\","open"
Dialog("Login").Activate @@ hightlight id_;_526058_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set "asdf" @@ hightlight id_;_264602_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "533d757daccdc22ee3f0018cac5e3c1584349abe" @@ hightlight id_;_395670_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog("Login").WinButton("OK").Click @@ hightlight id_;_395662_;_script infofile_;_ZIP::ssf4.xml_;_

If Window("Flight Reservation").Exist(10) Then
Window("Flight Reservation").Activate @@ hightlight id_;_591594_;_script infofile_;_ZIP::ssf5.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_264860_;_script infofile_;_ZIP::ssf6.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_133798_;_script infofile_;_ZIP::ssf7.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "1" @@ hightlight id_;_133796_;_script infofile_;_ZIP::ssf8.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_133794_;_script infofile_;_ZIP::ssf9.xml_;_
End If
------------------------------------------------------
'Exist Propery 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\","open"
End If
Dialog("Login").Activate @@ hightlight id_;_526058_;_script infofile_;_ZIP::ssf1.xml_;_
Dialog("Login").WinEdit("Agent Name:").Set "asdf" @@ hightlight id_;_264602_;_script infofile_;_ZIP::ssf2.xml_;_
Dialog("Login").WinEdit("Password:").SetSecure "533d757daccdc22ee3f0018cac5e3c1584349abe" @@ hightlight id_;_395670_;_script infofile_;_ZIP::ssf3.xml_;_
Dialog("Login").WinButton("OK").Click @@ hightlight id_;_395662_;_script infofile_;_ZIP::ssf4.xml_;_
----------------------------------------------
Window("Flight Reservation").Activate @@ hightlight id_;_2689534_;_script infofile_;_ZIP::ssf1.xml_;_
Window("Flight Reservation").WinButton("Button").Click @@ hightlight id_;_461482_;_script infofile_;_ZIP::ssf2.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON" @@ hightlight id_;_1313334_;_script infofile_;_ZIP::ssf3.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "4" @@ hightlight id_;_527008_;_script infofile_;_ZIP::ssf4.xml_;_
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click @@ hightlight id_;_1444396_;_script infofile_;_ZIP::ssf5.xml_;_
Window("Flight Reservation").WinEdit("Tickets:").Set 1 @@ hightlight id_;_1706630_;_script infofile_;_ZIP::ssf7.xml_;_
Window("Flight Reservation").WinButton("Update Order").Click @@ hightlight id_;_1968478_;_script infofile_;_ZIP::ssf8.xml_;_
Wait 8
Message = Window("Flight Reservation").ActiveX("Threed Panel Control").GetROProperty("text")

If Message = "Update Done..." Then
    Msgbox "Order Updated"
    Else
    Msgbox "Order Not Updated"
End If
----------------------------------------------
Advantages of Wait statement
-----------------------------
i) It won't Corrupt

ii) No object Reference is required

iii) It can be used internally as well as externally

iv) It can be used for Recordable and Non-Recordable statements

(* In order to capture screen shots during execution wait is useful)

V) In order to observe the Test execution process then wait statement is the only option.
-------------------------------------------------------

0 comments:

Post a Comment