Sunday, November 10, 2013

Synchronization In UFT 11.5

"Synchronization" It is a process of matching the speeds of both UFT and application(the app that we are testing ) in order to get proper execution results.

OR 

It is process of matching the tool time and application time in order to complete the script execution successfully with out any interruption.

When Synchronization is Needed ?

when we are running a test using UFT it ideally works with same speed and gives the instructions to the  application with the same speed some times the application may take some time for processing  the specific instruction at that time our UFT won't wait for that time it immediately process the next instruction then we can't get expected result and entire application will fail to test at that time we need to implement some synchronization mechanism for waiting the tool till it gets a response from application

There we use these synchronization feature.

example:
if we are testing an login application of any mail we need to login and click on signout button but the application will take some time for login after clicking on "sign in" so our tool needs to wait for ample amount of time for "signout "button then we will click on sign out so for waiting we use this synchronization concept.

Note:  The generally the application may fast/slow we are synchronizing the tool with app.

UFT provides the following methods /properties

1.Object Synchronization time out( ) or Default synchronization time out

2.Wait Property

3.Wait( )

4.Exist ( )

5.Sync ( ) <------- Only for Web

Note:
The default waiting time of our UFT is 20 sec and if the operation is performed in 1 second it wont wait for remaining 19 seconds it is called "Dynamisam" here we can increase the wait time to as we want.

1.Object Synchronization Time Out:

It is the maximum time provided by UFT by default to execute each statement individually within this time.

The default time is 20 seconds you can find the default time in the following path

File---->Settings---->Run--->Object Synchronization Time out please find the below snap shot



2. Wait Property:

It waits  untill  the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.

syntax:

Object.WaitProperty(PropertyName,propertyvalue,[timeout])

Object                 any test object
PropertyName:    the name of the property whose value is checked
Propertyvalue:     The value we are expecting
Timeout               optional time in milliseconds

Note:
It is for object level and synchronization time out is for Application level

example:

Flight reservation login app for this scenario

Adding login,flight reservation objects to OR


Find the complete code from below snap


here we are looking for Window named Flight reservation after clicking on Login button our UFT waits till the enabled property "true"/it will waits for till the timeout is completed UFT will execute next statement if any of the condition is true.

***Note:
The above two mechanisms are dynamic (i.e) they won't wait unnecessary time if the action completes even if we specify long time.

We can perform this kind of synchronization in recording modes also.

3.Wait( ) :-

In this method, without specifying the condition we can keep our tool in waiting state for specified amount of time.

Syntax:

Wait( time in seconds)
ex:

Wait(30)

Note:  It is fully static it will wait full amount of time even the action performed in short time than specified.

4.Exist ( ) :

It is used to check the existence of the application/objects  within the specified time.If the object is available within the time then it returns true otherwise it returns false.This method also dynamic if we get the required thing is less time than specified it will go to next statement.

syntax:

Object.exist(seconds)

5.Sync( ):<----------For web apps only

It waits for the browser to complete the current navigation

syntax:

Object.Sync

Notes:
1.For web apps default time wait is 60 seconds and for windows it is 20 seconds only.


2.If there is any conflict in UFT tool default settings time and explicit settings like  Exist( ),Wait( ), WaitProperty  high priority will be there for external settings only.

3.If we are not specified as external it will take internal settings and perform the operations.

This is sign off of Synchronization Concepts If you need any information on these examples please reach out me I can able to help on them. 

1 comment:

  1. Two Queries:

    Sync does not work everytime. why this is the case?

    what is the difference between browser.sync and browser.page.sync

    ReplyDelete

Admin will respond you with in next 24 hours