QTP: Improving script execution speed

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!

«February»
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678