Creating automation scripts using QTP (Quick Test Professional) is mostly same as developing an application.
We need to follow the standard procedures to develop the scripts.
Find below some the automation script development tips based on my experience.
If you want to learn QTP from me, you can refer this previous blog post.
Read the Requirements completely and repeatedly till understanding it clearly without any ambiguity. It is better to create own automation testcases/requirements based on the manual test cases or business requirement document.
Highlight or make note of key requirements in the requirement document. And, highlight the points that are difficult to understand.
Don’t hesitate to approach the developer/customer/client if you need any clarification in the requirement and also don’t hesitate to inform if any of the requirements is unrealistic. Prepare a list of requirements or test cases which can not be automated.
QTP Script development Team also should participate in the requirement analysis before starting any application development activity. QTP Automation team can give suggestions (e.g giving unique name/id for each window so that object identification problem can be avoided when creating QTP scripts) for the application development Team for improving effectiveness of the QTP script development.
Start working on coding/scripting part only after getting clear understanding of the overall Design of the system. i-e First you should concentrate more on gathering enough details for preparing your QTP automation framework.
Enforce Review and Walk Through Activities. It should be done during every phase of the automation script development. i-e Automation frame work should be reviewed by each member of the Automation Team. And, everyone should review the Object Repository once after adding all the required objects with required properties and with meaningful logical name.
Try to setup Development Environment similar to production environment. Otherwise you will face lot of difficulties while running the QTP script against the production application once after completing your script development using development/testing application. You should use AOM (Automation Object Modeol)to move the script settings from development environment to production (i-e Test execution) environment
Do unit testing immediately after developing each small functionality. For example once after adding the object repository, use the Highlight feature in the Object Repository to make sure that the added Object can be identified.
Give updates of the progress to the client/customer frequently. If you are facing any difficulty/issue remember to specify in the updates.
Make list of things that will vary from Development Environment and Production environment. For example path of config file and Recovery Scenario file.
Prepare a user guide document and deliver it along with code. It should clearly specify the steps required for running the scripts and for analysing script. And, it should contain enough details to run the scripts partially, if the script execution fails in between the execution.