QTP: Basic Standards: I feel these standards are necessary
I feel these standards are necessary even with the basic structure of automation.
1) Make All Actions Reusable. Why?
a) Because only reusable actions can be called multiple times from the current test or from another test.
b) Reusable actions makes it easier to maintain your tests, because when an object or procedure in your application changes, it needs to be updated only one time, in the original action.
To do this: Open a Script=>Go Edit=>Action=>Action Properties=>Select the CheckBox at the Bottom for "Reusable Action"
2) Configured Each Action as below. Why?
a) Because when multiple scripts get executed and First one fails the
QTP executes NEXT script
To do this: Open a Script=>Go to File=>Settings=>Run and Select "proceed to next action iteration" for "When error occurs during run session".
3) Do not use ExitRun() function
Because you cannot execute multiple script. For example, you want to execute Script1 and Script2. If Script1 fails then Script2 will NOT be executed.
4) Use ExitAction function
Because you can execute multiple scripts. For example, you want to execute Script1 and Script2. If Script1 fails then Script2 will get executed.
Re: QTP: Basic Standards: I feel these standards are necessary
On the other hand, I only use the default action and have coded a framework to open scripts or suites of scripts and perform the actions (keyword driven testing) that needs to be done.
I use exitrun() because when my framework handles everything and comes to the end I do the exitrun() and now I can have all that foo code snipettes at the bottom of my script for the Test|Run from step command. I use that a lot to try out ideas and not lose them.