Synchronization is the process of matching the speed of the AUT and QTP inorder to get the proper execution of results.As part of the script execution QTP give the instructions step by step with the same speed. Sometimes AUT may respond quickly. Sometimes AUT may take time to respond. In such kind of situations we may not proper result. To resolve these type of issues, we can use synchronization.
Synchronization can be done by using any one of the following methods.
01. Using Wait method:By using this we can make the script to wait for n-number of seconds before moving to next step. But this is not most useful method. Assume that we have given the waiting time as 20 seconds and the AUT is responding in 5 seconds. But the execution will be resumed after 20 seconds only.Wait method is useful to capture the screenshots when the script is waiting for the desired number of time. Wait method doesn't requrie any references.It's a VBScript function.So, can be used globally.
Syntax:Wait(time in seconds).
02. Inserting Synchronization points: Make sure that QTP is in recording mode.Keep the cursor in the desired location and navigate to Insert menu> Synchronization point>select the object> OK> select property name and value as True>Enter time in milli seconds and click ok> Stop recording.
Synchronization can be done by using any one of the following methods.
01. Using Wait method:By using this we can make the script to wait for n-number of seconds before moving to next step. But this is not most useful method. Assume that we have given the waiting time as 20 seconds and the AUT is responding in 5 seconds. But the execution will be resumed after 20 seconds only.Wait method is useful to capture the screenshots when the script is waiting for the desired number of time. Wait method doesn't requrie any references.It's a VBScript function.So, can be used globally.
Syntax:Wait(time in seconds).
02. Inserting Synchronization points: Make sure that QTP is in recording mode.Keep the cursor in the desired location and navigate to Insert menu> Synchronization point>select the object> OK> select property name and value as True>Enter time in milli seconds and click ok> Stop recording.
Syntax: Object.WaitProperty "property name","value",time in milli seconds
03. Increasing QTP default time wait:We can change the QTP synchronization time out by navigating File> Settings> Run tab > Increase the synchronization time out.The same time setting is applicable for all steps in the script. But the main advantage is the script will move to next step as soon as the current step is over. It'll not wait for the maximum amount of time configured.
04. Sync method: This method can be used with web based applications only. This method waits for the browser to complete the current operation.
Syntax: Browser("aaa").Page("bbb").Sync
Appropriate Methods selection:
01.Suppose in our test one or more statements only are taking more time for execution then selecting “Inserting synchronization method” is better.
02. Suppose in our test more statements are taking more time for execution then selecting “increasing tool time out” .
03. 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.
03. Increasing QTP default time wait:We can change the QTP synchronization time out by navigating File> Settings> Run tab > Increase the synchronization time out.The same time setting is applicable for all steps in the script. But the main advantage is the script will move to next step as soon as the current step is over. It'll not wait for the maximum amount of time configured.
04. Sync method: This method can be used with web based applications only. This method waits for the browser to complete the current operation.
Syntax: Browser("aaa").Page("bbb").Sync
Appropriate Methods selection:
01.Suppose in our test one or more statements only are taking more time for execution then selecting “Inserting synchronization method” is better.
02. Suppose in our test more statements are taking more time for execution then selecting “increasing tool time out” .
03. 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.
0 comments:
Post a Comment