Header Ads

Wait or Sync which one is better in QTP or UFT??

Facing problem with Syncronazation with AUT is most common for Automation Test Engineers..


Well to be very frank,Even i had struggled very much with this...


let me tell you what is wait..
Wait:This command is used to stop QTP(forcefully) for the specified time.If you are very sure within that time frame the Application is bound to open ,It is very smart to use it.


Example:Wait(5)


It can not be used to any client based viz window based application.But the main problem is if the application appears before your wait time,then you loose time.and if the other things happens that means you loose control.


Sync:This command is var efficient than Wait...may be solve the problem of wait.This command interacts with application and give full time to load it.But i have seen scripts failing inspite of having a sync command.


Example:browser("micClass:=Browser").Page("micClass:=Page").sync
To my point of view the best approach is
'*******************************************************************************************************************'METHOD NAME : F_Sync
'ARGUMENTS : obj,Max_Wait,result
'DESCRIPTION : Waits for Oracle Navigator
'RETURNS : None '*******************************************************************************************************************Function F_Sync (obj,Max_Wait)
Dim Wait_Time flag_wait = "False"
Wait_Time=0
Do
If obj.Exist(2) then
flag_wait="True"
Else Wait_Time=Wait_Time+5
If Wait_Time> Max_Wait Then
Exit do
End If
End If
loop until flag_wait = "True"
End Function
---------------------------------------------------------------------------------------
obj will be
Set obj=Browser("ABC").Page("VCV")








Powered by Blogger.