Synchronization is the time interface between tool (like QTP) and Application under test.
Synchronization is used to match the speed of UFT test script execution with the speed of the application under test.
UFT test can be synchronized in the following way :
- Wait Statement – Wait is used when we want UFT to wait for the specified time. Once the specified time is lapsed, UFT process with execution of the next step.
Syntax – Wait (seconds)
Example – Wait(5)
- Exist Statement – Exist is a method which take Timeout value as input to perform the synchronization and returns a Boolean value for the same. Based on the Boolean value, appropriate step can be taken to handle the timing mismatch.
Syntax – Object.exist(seconds)
(seconds Parameter is optional, incase it is not given it would take the default synchronization time “File > Setting > Run > Object synchronization timeout” )
Example –
Set object = Browser(“CreationTime:=0”).Page(“Index:=0”).Link(“text:=Login”, “html tag:=A”)
If object.Exist(5) Then
object.Click
End If - WaitProperty Statement – WaitProperty is used to wait until the given object property achieves the specified value in the given timeout else it continues to the next step.
Syntax – object.WaitProperty(PropertyName, PropertyValue, [TimeOut])
(TimeOut Parameter is optional, incase it is not given it would take the default synchronization time “File > Setting > Run > Object synchronization timeout”)
Browser(“CreationTime:=0”).Page(“Index:=0”).Link(“text:=Login”, “html tag:=A”).WaitProperty “text”, “Login”,5000 - Sync Statement (Only for Web)- Sync statement Waits for the browser to complete current navigation.
Syntax – BrowserObject.Sync
Example – Browser(“CreationTime:=0”).Page(“Index:=0”).Link(“text:=Login”, “html tag:=A”).Click
Browser(“CreationTime:=0”).Sync - UFT Inbuilt Synchronization points – A Synchronization point can be inserted which makes UFT pause the test until an object property achieves a specified value.
Steps to Inserting a Synchronization points
step 1. Start recording mode, Select “Design > Synchronization Point”
step 2. Click the object in your application for which want to insert a synchronization point. Object selection dialog box will open as shown below.
Step 3. Select the object for which want to insert a synchronization point. Click OK.
Step 4. Add Synchronization point dialog box will open as shown below. Define the property name, Value and timeout in milliseconds.
Step 5. Click OK. A Waitproperty step is added to the test. - Default Synchronization – UFT provides some time setting for the test which makes UFT wait for the mentioned time in the setting.
Browser navigation timeout – Browser navigation timeout setting makes UFT wait for the web page to load completely for the specified amount of time. This setting is applicable only for web application.
Browser navigation timeout setting is found in “File > Setting > Web > Browser navigation”
Object Synchronization timeout – Object Synchronization timeout setting makes UFT wait for the specified amount of time for the objects to appear. By default the time setting is 20 seconds which can be modified.
Browser navigation timeout setting is found in “File > Setting > Run > Object Synchronization timeout ”
Leave a Reply Cancel reply