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.
- 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.
- Follow coding guidelines like comments, variable & function name declaration.
- Use option explicit to enforce variable declaration. Always define variables at the top of script & function file
- 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
- In large tests, define reusable codes as function in external .vbs file. It consumes less memory than QTP Action.
- QTP is a hardware hungry application, machine should be hardware rich.
- 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.
- 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.
- 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.
- . 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.
- User relative paths while calling library file, reusable action, data files. It makes script portable and easy to manage.
- . Don’t overuse recovery scenario, recovery scenario slow down script execution time
- . 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.
- . 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.
- . 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.
- Save the test results report to a temporary folder to overwrite the results from the previous run session every time you run a test.
No comments:
Post a Comment