QTP Best Practices

HP Quick Test Professional is a test automation tool, also known as QTP. It is used to automate functional, regression & smoke test cases. It is a very popular tool and works on MS windows O/S, supports development technologies like Active X, Delphi, Java, .Net, Oracle, People Soft, web, Web services etc. This article discusses about best practices while doing automation using QTP.
  1.     Don’t use msgbox function, this function pauses the script execution & requires user intervention. This defeats the objective of unattended script execution. To store or display error message and execution log use QTP inbuilt Reporter object.
  2.       Follow coding guidelines like comments, variable & function name declaration.
  3.       Use option explicit to enforce variable declaration. Always define variables at the top of script & function file
  4.       Neither hard code test data nor read value using custom function like Inputbox. Use parameterization to enhance reusability of code. QTP provides inbuilt support for Microsoft excel files, store test data in excel file, import excel sheet in QTP DataTable, read value using “DataTable.value” function
  5.       In large tests, define reusable codes as function in external .vbs file. It consumes less memory than QTP Action.
  6.       QTP is a hardware hungry application, machine should be hardware rich.
  7.       Use synchronization (like exist, sync etc.) to mitigate timing issue between script & Application under test. Don’t use wait (10) statement. Don’t increase global synchronization time out value; it slows down QTP execution speed.  Ideal solution is implement synchronization at object level not at global level.
  8.       Create reusable function instead of reusable action; minimize number of actions in a test. Ideally, a test should not contain more than few actions. An action takes more time to load and run. Its limited use improves execution speed.
  9.       Be tactful in using QTP features like Descriptive Programming or Object Repository or mixed approach. Each approach has its own merit & demerit. Try to use mix of both.
  10. .   Don’t use inbuilt feature like “Save still image capture to results” and “Save movie to results”. These options decrease QTP run time performance. If required, use VB Script code to take screenshot of script failure.
  11.     User relative paths while calling library file, reusable action, data files. It makes script portable and easy to manage.
  12. .    Don’t overuse recovery scenario, recovery scenario slow down script execution time
  13. .   Do not load un-necessary Add-ins. When QTP starts, it shows list of add-in available, select only required add-in. This will improve performance while learning objects and during run sessions.
  14. .    Run your tests in "Fast mode. From the Run pane in the Options dialog box, select the Fast option. This enables QuickTest, run test faster.
  15.   .  Hide Active Screen. If you are not using the Active Screen while editing your test, hide the Active Screen while editing your test to improve editing response time.
  16.    Save the test results report to a temporary folder to overwrite the results from the previous run session every time you run a test.

Comments

Popular posts from this blog

Testing Webservice with SoapUI Having Windows Authentication

How to Re-run Failed Scenarios in Cucumber

Data Driven Testing Using Selenium -WebDriver in Python