If an action is no longer needed in QTP Test Script, you can remove it from your test. If the action is stored with your test (reusable or non-reusable action) and is called only once in the test, then removing the action deletes it entirely. Alternatively, if the action is stored in another test (external action), or is called more than once in this test (reusable action), removing the action deletes the selected call to the action, without affecting the source action.

The following table illustrates what happens when you delete an action:

Delete Actions

Tips for Removing Action Calls and Deleting Actions

  • QTP provides several locations from which you can remove calls to actions:

    Resources pane. Use to simultaneously remove all calls to a specific action.

    • If you remove a reusable or non-reusable local action, QTP removes all calls to the action in this test and deletes the action in its entirety.

    • If you remove an external action, QTP removes all calls to the action from the test, but does not affect the source action in any way.

    Test Flow pane or the Keyword View. Use to remove specific calls to an action.

    • If a test contains multiple calls to a single reusable action, and you remove some—but not all—of the calls, QTP removes the calls to the action in the specified locations, but does not delete the action itself. This means that the action can continue to be called by this test and by other tests, as needed.

    • If you remove all calls to an action, the result is the same as removing the action from the Resources pane. For reusable and non-reusable actions, QTP removes all calls to the action in this test and deletes the action in its entirety. For external actions, QTP removes all calls to the action from the test, but does not affect the source action in any way.

  • When QTP deletes an action in its entirety, the corresponding action sheet is removed from the Data Table, but columns related to this action that are located in the Global sheet are not removed.

  • If you open a test containing a call to an action you removed, QTP informs you that the action is missing.

To remove a call to an action or delete an entire action:

  1. In the Resources pane, the Test Flow pane, or the Keyword View:
    • Right-click the action you want to remove and select Delete.

    • Select the action you want to remove and press the Delete key on your keyboard.

    • Select the action you want to remove and select Edit > Delete.

  2. Click Yes in the confirmation message box.

    Note: If an action stored in this test is called by other tests, deleting the action in this test may cause other tests to fail.

0 comments