Tips to Optimize QTP Performance -

-->Exclusive Portal for Testing Jobs

Tips to Optimize QTP Performance

  1. Dim your variables. Declared variables are faster than variables that are not declared. Once a variable is declared it is assigned an ordinal at runtime, but an undeclared variable is referenced by name every time it is used, which slows it down considerably.
  2. Use Option Explicit at the beginning of all your scripts. Setting Option Explicit forces variable declaration. This is a good thing, as we saw in Tip #1. Also –Option Explicit has the added benefit of helping to debug, since it can point out any misspelled variable references.
  3. For screen/object synchronization, use the Exist statement or Sync rather than the Wait statement. A Wait statement tells QTP to pause for the full amount of time you’ve entered. Wait(10) will pause for exactly ten seconds — even if the object you are waiting for appears sooner. But an Exist(10) will only wait up to ten seconds. That means that if the object appears in two seconds, the Exist will continue after only two seconds rather then wait the full ten.
  4. If you are using functions with keywords, place them in order of common usage rather than alphabetically.
  5. Use local variables rather than global variables for functions. Local variables are faster than global variables, so use local whenever possible.
  6. Set QuickTest’s ‘Run Mode’ to Fast. To set in QTP, go to Options\Run. This setting changes the script’s run behavior so that it will run without the execution arrow to the left of the Expert view (or Keyword view). The test will also not expand the item tree, nor display the script of each action as it runs. Also, this setting requires fewer system resources. Also if you don’t care about capturing images in the result –on an error– you could un-check ‘Save still image captures to results’ under Run\Screen Capture.  Same thing for the ‘Save movie to results ‘ setting.
  7. Use the Object Repository (OR). Scripts run faster if all the objects are in the QTP OR as opposed to using straight descriptive programming. However, I’ve also seen extremely large object repositories create performance issues; especially in Business Process Tests. What I prefer to do is use a mix of both.
  8. If your test has a dynamic object that sometimes appears use the ChildObjects method to check if it exists rather than use the Exist statement.
  9. If you are creating objects make sure you destroy them after using them.  In long scripts you don’t want to have unnecessary object still in memory.  This can cause QTP to slow down. To eliminate a variable reference to its object set it to Nothing
  10. Turn off QTP’s ‘Active Screen’ option.  If you are recording against an application and it appears that either QTP or the APP (or both) are slow or appear to hang disable Active screen. This behavior can appear if you are recording against a screen that has a large number of objects or have deep object hierarchies. To disable go to Tools\Options\Active Screen and set the Capture Level to “None”.
Reference: joecolantonio
Note: For any questions or concerns related to testing please reach us its simple.
Click on the chat Icon(bottom right corner of the page), enter the details and send it. we will try to answer them as soon as possible.

To receive daily posted JOBS & Interview Questions
Just enter your email address below and click 'Submit'
Enter your email address:

Make sure to activate your subscription by clicking on the activation link sent to your email