Monday 30 September 2013

UFT/QTP- Synchronization


how to use sync method in qtp, sync in qtp, sync method in qtp, syntax for sync in qtp


Synchronization:

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.

Different methods in QTP for Synchronization:

1. Wait statements.
2.  Exist Statements.
3. Sync Method (Only for WEB).
4. Inserting Synchronization points.
5. Increasing Tool default synchronization time.

Wait Statements:

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

Exist Statements:

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"

 'Cick 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

No comments:

Post a Comment