Insert Multiple Actions in a QTP Script

Share This Post -

When you create a QTP Script, it includes one action. All the steps you add and all the modifications you make while editing your test are part of a single action.

You can divide your test into multiple actions by creating new actions and inserting calls to them, by inserting calls to existing actions, or by splitting existing actions. The actions used in the test, and the order in which they are run, are displayed in the Test Flow pane.

There are three kinds of actions:

  • Reusable action. An action that can be called multiple times by the test with which it is stored (the local test), as well as by other tests.

  • Non-reusable action. An action that can be called only in the test with which it is stored, and can be called only once.

  • External action. A reusable action stored with another test. External actions are read-only in the calling test, but you can choose to use a local, editable copy of the Data Table information for the external action. By default, new actions are reusable. You can mark each action you create in a test as reusable or non-reusable. Only reusable actions can be called multiple times from the current test or from another test. You can store a copy of a non-reusable action with your test and then insert a call to the copy, but you cannot directly insert a call to a non-reusable action saved with another test. Inserting calls to 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.
    Two or more tests can call the same action and one action can call another action (this is known as nesting an action). Complex tests may have many actions and may share actions with other tests.


When you run a test with multiple actions, the test results are divided by actions within each test iteration so that you can see the outcome of each action, and you can view the detailed results for each action individually.


Go Back to: Working with Actions in QTP