It is a process of matching the speeds of both QTP and AUT in order to get proper execution and results.
Where Synchronization is required:
During test execution QTP gives instructions one by one with same
speed, but AUT takes less time for some operations execution and more time for
some operations execution, that time we may not get proper execution and
results. In order to get proper results in between QTP & AUT
synchronization is required.
There are several methods available in QTP for synchronization.
1. Inserting Wait statements.
2. Inserting Synchronization points.
3. Increasing Tool default synchronization time.
4. Sync Method (Only for WEB)
5. Exist Property
Inserting Wait Statements:
We can insert wait statements in our test in order to make QTP to
wait until AUT completes current operation.
Syntax: Wait(time in seconds)
Note: If we insert wait statements QTP waits up to maximum time
even though operation is completed.
Inserting Synchronization points:
Place cursor in desired location>keep tool under recording
mode>Insert menu>Synchronization point >show the object >click
ok>select property name & Value(True)>enter time in Milli
seconds>click ok>Stop recording.
Note: if we insert Synchronization points, it does not wait up to
maximum time, after completion of the current operations, it goes to next step
immediately.
Syntax: object hierarchy.waitproperty “property name”,value,time
in milli seconds.
Increasing Tool default synchronization time:
Navigation: File>settings>run tab>increase object
synchronization time out>apply>ok
Note: If we increase QTP tool default time that can be applied for
all statements in the test, but QTP does not wait up to maximum time
unnecessarily, After completion of one statement execution it goes to next
statement immediately.
Sync Method: (only for WEB)
Waits for the browser to complete current navigation.
Syntax: Object Hirearchy.Sync
Ex: Browser("Yahoo! Toolbar").Page("Yahoo!
Toolbar").Sync
Selecting an appropriate Method:
1. Suppose in our test one or more statements only are taking more
time for execution then selecting “Inserting synchronization method” is better.
2. Suppose in our test more statements are taking more time for
execution then selecting “increasing tool time out” .
3. Above two are local features but wait statement is Vbscript
feature, even though some drawbacks are there in using wait statement, it is
better to use wait statement in functions.
Advantages of Wait Statement:
Advantages of Wait Statement:
1) It is a VBScript statement, we can use this globally
2) It is recommended, whenever we want to observe the Test
Execution process
3) No object reference required to insert wait statements
4) It is useful to make QTP capture values and screen shots during
test execution
No comments:
Post a Comment