Tuesday, January 10, 2012

QTP : Actions

A test can be divided in to actions to streamline the process of testing your application. Actions divide tests in to logical units.The actions used in the test and the order in which they are run, are displayed in the test flow pane. Test can be divided in to multiple actions by:
  • Creating new actions and inserting calls to them.
  • Inserting calls to existing actions.
  • Splitting existing actions.

Types of Actions
There are three kinds of actions:
  1. Reusable action: An action that can be called multiple times by the test with which it is stored as well as by other tests.
  2. Non-reusable action: An action that can be called only once in the test with which it is stored, and cannot be used by other tests.
  3. External action: A reusable action stored with 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.
Creating New Action
  1. if you want to insert a call to the new action from an existing action in your test, click the step after which you want to insert the new action.
  2. Select Insert>Call to New Action or click the Insert Call to New Action button on the Insert toolbar. The Insert Call to New Action dialog box opens.
                       
  3. In the Name box, type a new action name or accept the default name.
  4. In the Description box, add a description of the action. You can  also add an action description at a later time using the Action Properties dialog box.
  5. Ensure Reusable Action is selected if you want  to be able  to call the action from other tests or multiple times from within this test. By default this option is selected.
  6. Decide where to insert the call to the action by selecting At the end of the test or After the current step.
  7. Click OK. A new action is stored in your test.
Splitting Actions
You can split an action into two sibling actions or in to parent child nested actions. When you split an action in your test that uses a local object repository. The two actions have identical local  object repositories containing all of the objects that were in the original local object repository.

Steps to split an action
  1. Select the step before which you want the new action to begin.
  2. Select  Edit>Action>Split Action. the Split Action dialog box opens as shown below:

             
  3. Select one of the following options:
    • Independent of each other: splits the selected action in to two sibling actions.
    • Nested: Split the action in to Parent Child action. By nesting actions you can maintain the modularity of your test.
  4. If you want, modify the name and description of the two actions, use the Name and Description boxes.
Inserting calls to Actions
Steps to call the Copy of Action in your test:
  1. While recording or editing your test, choose Insert>Call to Copy of Action. The Select Action dialog box opens.
                           
  2. Use the From test browse button to select the test.
  3. Use the Action drop down to select a reusable action.
  4. Decide where to insert the call to the copy of the action and select At the end of the test or After the current step.
  5. Click OK. The action is inserted into the test as a copy of the action.
Inserting Call to an Existing Action
Steps to insert a call to an existing Action:
  1. Choose Insert>Call to Existing Action. The select action dialog opens.
                
  2. Use the From test browser button to find the test that contains the action you want to call. The Action box displays all reusable actions in the test you selected.
  3. Use the Action drop down to select a reusable action.
  4. Decide where to insert the call to the copy of the Action and select At the end of the Test or After the current step.
  5. Click OK. A call to the Action is inserted in the test flow.






















No comments:

Post a Comment