Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Monday, 6 July 2015

Synchronization

Synchronization point is time interface between Tool and Application under test. Generally Synchronization point is to give waiting time to the tool before executing next step in Test script.

Different methods in QTP for Synchronization:
  1. Wait.
  2. WaitProperty
  3. Exist.
  4. Sync Method (Only for WEB).
  5. Inserting Synchronization points.
  6. Increasing Tool default synchronization time.
Wait Statement:
Wait statements are used when we want QTP to wait for specified time, so that AUT completes its current operations.

Wait (n) statement waits for specified 'n' seconds.
Wait () statement without specifying the seconds will make QTP wait up to maximum time, even though operations is completed.

Example:
Systemutil.Run "iexplore.exe","http:\\www.gmail.com"
‘Wait for 5 sec for Gmail browser launch
Wait 5
‘Enter Email id in Username Field
Browser ("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebEdit("name:=Email").Set  "qtpworld.com"
'Enter password in Password Field
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebEdit("name:=Passwd").Set  "qtp"
'Cick on the Sign In Button
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebButton("name:=Sign in").Click

WaitProperty :
WaitProperty is a method that takes the property name, value and Timeout value as input to perform the sync. It is a dynamic wait and hence this option is encouraged.

Example
Dim Number
Set Number=Browser("Math").Page("Math")
Number.Link("Number").Click

Number.Link("").WaitProperty "text","Simple",25000
Number.Link().Click.

Exist Statement:
We can enter Exist statements to instruct QuickTest to wait for a window to open or an object to appear. Exist statements return a boolean value indicating whether or not an object currently exists.

Example:
Systemutil.Run "iexplore.exe","http:\\www.gmail.com"
'Wait till Gmail browser exists
Do while  Browser("title:=Gmail: Email from Google").Exist(1) = False
Wait 1
Loop
'Enter  Email id in Username Field
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebEdit("name:=Email").Set  "qtpworld.com"
'Enter password in Passowrd Field
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebEdit("name:=Passwd").Set  "qtp"
'Ciick on the Sign In Button
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebButton("name:=Sign in").Click

Sync Method: (only for WEB)
Waits for the browser to complete current navigation operation.

Syntax:
Object hirearchy.Sync

Example:
Systemutil.Run "iexplore.exe","http:\\www.gmail.com"
'Wait till Gmail browser launches
Browser("title:=Gmail: Email from Google").Sync
' Enter  Email id in Username Field
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebEdit("name:=Email").Set  "qtpworld.com"
 'Enter password in Password Field
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebEdit("name:=Passwd").Set  "qtp"
'Cick on the Sign in Button
Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").WebButton("name:=Sign in").Click

Inserting Synchronization points:

Synchronization point is nothing but time interface between Tool and Application build. Generally Synchronization point is to give waiting time to the tool before executing next step in Test script.
Steps to follow for Inserting Synchronization points:

Position cursor in desired location-->QTP should be in recording mode-->Insert menu-->Synchronization point -->Show the object -->click OK-->select property name and Value (True)-->enter time in Milli seconds-->click OK-->Stop recording.

Increasing Tool default synchronization time:
Default Time in QTP is 20 Seconds.
Steps to follow for Increasing default synchronization time:
File-->settings-->run tab-->increase object synchronization time out-->Apply-->OK