Are you experiencing slow execution of your scripts? Does it take much time to execute your scripts than it should be? If you feel that your qtp script execution has slowed down or there is a need to increase the speed, consider the points below to improve the performance of qtp script execution.

1. Set QuickTest Run Mode to Fast

Consider changing the run mode to fast. You can do this at the Tools >Options > Run tab. The Change in behaviour can be seen at run-time. The yellow execution arrow which you see in the left bar of your script statements will not be there now. The tests will not expand the tree and it will not show up the scripts for each action as well.

2. Images and movie capture

Unless you don’t need it, do not put these settings ON. These settings are at Tools > Options> Run > Screen Capture. Uncheck ‘save movie results’ and ‘save still images. If you really want images to be captured, set it ‘for errors’ instead of ‘always’

3. Load only the required Add-ins 

Just load those add-ins which are required for your automation.

Uncheck all unwanted add-ins at  Add-in Manger at start up.

4. Disable Active Screen

Active screen takes lots of disk space and it makes your script slower. You can notice while modifying your scripts, update of the active screen takes few seconds to load. So until unless you don’t need it, Close the Active screen window and do not save the tests with active screen. clear the option ‘Save active screen file’ in ‘Save’ Dialog.

If you really want to have this, consider checking the Capture level at Tools > Options > Active Screen.

5. Recovery Scenario

This is very crucial as far as performance is concerned. Try not to use them as far as possible. avoid having unwanted pop-ups like for printers, anti-virus etc on the machine. Some browser popups can be disabled manually by selecting “do not show this next time” before actually automating scripts.

Most of the recovery operations can be handled or avoided from the script. for example – Exist method can be used for the statements to avoid having a situation for a recovery scenario.
If you are using this, try avoiding it to enable it for every step. Configure it at File > Settings > Recovery Scenario tab. Set “on error” for “activate recovery scenario”.

5. Importing sheet

See also  Going Back to QTP 11 from UFT 11.5

If you are making use of an external excel file and you are importing it into a data table, then make sure you are doing it once, not for every iteration.

for example: If the first line of your script is Datatable.Import(filename) and you have enabled “run on all iterations”, you are simply importing the sheet every time unnecessarily. In such cases, set the mode to “run one iteration only” and use a loop after the import method

6. Declare variables

Scripts with variables declared are usually faster than the scripts where you don’t declare variables using DIM. If a variable is not declared it is always referenced by name every time it is used, which slows down the execution. Use OPTION EXPLICIT at the beginning of your script which forces to declare variables.

7. Avoid using Wait Statement

Use Exist or sync method for synchronization, rather than using the Wait statement.

8. Use Object Repository

Scripts run faster if all the objects are in the Object Repository rather than using straight descriptive programming in the scripts. if you have a large object repository then also it creates performance issues. a mix of both should work better.

9. Use With Statement

Usage of with statements help in reducing the number of function calls and so the execution time. Use with statements for a set of statements rather than writing the same code multiple times.

So, these are some of the methods, which I would recommend to improve the performance of your automation scripts.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.