Geeks With Blogs

News QTP and Stuff
Theo Moore Questions... Morphology? Longevity? Incept dates?

Someone posted asking for some general ideas on how to improve script execution. I don't have access to their code, and therefore can't address anything specific in their code, but here are some general ideas on how to improve QTP speed:


  1. Remove the setting in options that allows the cursor to follow the execution. This is actually pretty costly. If you aren't debugging, chances are you don't need it.
  2. Get rid of the active window. Don't use it! It looks pretty, but really increase memory and processing power for your script.
  3. Don't great multiple instances of the same object to get the job done. If you need to create a FileSystemObject, for example, create one and pass it around if you need it in a few places. Creating/destroying the object everywhere is expensive.
  4. Use VBscript error handling over recovery scenarios. Recovery scenarios are very expensive as it hooks up a listener to your script. This listener is very processor intensive and slows it waaaaay down. If you must use the scenario approach, get it to a minimum.
  5. Use local resources, if possible. If you are waiting on a network resource, this can really slow your script down.
  6. Get rid of the Exist statement where possible. Even when the Exist statement is used with 0 as its parameter for timeout (meaning it shouldn't have one), it can be really slow. Better to either create your own function to check the XMLDOM if it is web. If you're using Win...well, try to minimize how much you use it.
  7. Avoid QTP's inherent objects. I know this seems counter-intuitive, but here's the deal: I don't think Mercury/HP builds their objects very well. If you've ever examined the OTA (Open Test Architecture) API, you know what I mean. Enough of that here, though...more on the OTA in the future. Basically, if the functionality can be replaced with some other object and some code, it's worth the effort to wire it up yourself in many cases.

Well, that's as much as I can think of without something more specific to work with like a test. Enjoy!

Posted on Sunday, February 3, 2008 3:26 PM | Back to top

Comments on this post: QTP: Improving script execution speed

# QTP implementation
Requesting Gravatar...
Hi there,
am krishna new to QTP,
I have learned QTP course and now trying to work but unable to work on it.

I can you send me a complete sample project were the implementation of QTP by using Dp and functions step by step procedure.

Like where are have to follow the scripting were Function and DP used and ploting the complete scenario of application.

With you sample project explaination i want to take up project start working on it.

my email ID is :
waiting for you reply immediatly.
Left by krishna( on Feb 11, 2008 3:18 AM

# re: QTP: Improving script execution speed
Requesting Gravatar...
can you send me a complete sample project were the implementation of QTP by using Dp and functions step by step procedure
Left by sudha on Mar 05, 2008 4:41 AM

# re: QTP: Improving script execution speed
Requesting Gravatar...
I have also heard that QTP Actions have a higher overhead than using user-defined functions. I can't confirm but my preference is to use functions/subs rather than Actions.

Left by Pete Townsend on Mar 26, 2008 12:07 PM

Comments have been closed on this topic.
Copyright © Theo Moore | Powered by: