9 Dec 2012

Synchronization


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

Wait statements
Exist Statments
Sync Method (Only for Web)
Inserting Synchronization points
Increasing Tool default synchronization time

Wait Statements

Wait statements is 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 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

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

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

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 Syncronization 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 syncronization time
File-->settings-->run tab-->increase object synchronization time out-->Apply-->OK

No comments:

Post a Comment