Search here for all the info you want in this Blog

Actions

Creating QTP script with a set of logical modules are called Actions. By default each test will have an action called “Action1”.

Advantages of using Actions:
1.Actions increase the readability. (i.e, It is easy to read & understand action by action, rather than the entire script)
2.Debugging is also easy. (We can debug the action directly)
3.Reusability (i.e, the actions created in one script can be reused in the same script or in a different script)

Types of Actions:
1.Non-reusable Actions (Default)
2.Reusable Actions
Internal Actions
External Actions

Internal Action: Creating an action and reusing it in the same script is called as Internal Action
External Action: Creating an action in one script and reusing it in another script is called External action.

Steps to create a script with multiple Actions:
1.Open a new test in QTP (By default there will be an action called Action1)
2.Click on Record --> Create a script for Action1
3.Select Insert --> “Call to New Action” option from menu
4.Provide the name of the action, description, reusability & location --> Click on OK
5.Create the script for the action
6.Repeat the above 3 steps to create multiple actions in the script.

Note:
1)Apart from “Action1” we can create 255 actions in one single script.
2)When we create a script with multiple actions, the object repository contents are maintained separately for each action. (i.e., Per Action Object repository)
3)For each action, the data table sheets are also maintained separately
4)The expert view lists the actions in the alphabetic order. To understand the order in which actions get executed, check it in the keyword view not in Expert view.
5)To change the order of the actions execution, drag & drop the action in the required place from keyword view.

Steps to edit the properties of an action:
1.Select an action from the drop-down in the expert view
2.Select Edit --> Action --> Action Properties
3.Edit the properties like Name, description, & re-usability.
4.Click on OK

Reusing of Actions:
We can reuse an action in the same script in which it is created or in a different script. 
To reuse an action we have 2 options
1.Call to Existing action
2.Call to Copy action

Steps to Reuse an action using ‘Call to Existing’:
1.Ensure that the source script is available in the shared location
2.Go to the target script in which an action needs to be called
3.Select Insert --> Call to Existing action (OR) Right Click --> Action --> Insert Call to existing
4.Provide the path of the test. (It automatically displays all the reusable actions from the script)
5.Select the required actions from the list
6.Select the location --> Click on OK
Eg: RunAction “StuReg[ActionsExp]”,OneIteration

Note: 
1)We can also reuse an action by using “Call to Copy Action”
Eg: RunAction “Copy of StaffReg”,OneIteration
2)When ever we reuse an action, we get all the resources required like source code, data table contents & object repository contents.



Difference between ‘Call to existing’ & ‘Call to Copy


Call to existing
1. In this all the resources like source code, data table contents & object repository contents are non-editable
2. If source action is modified, it will have impact on the target script as it is still referring to the source script.
3. While trying to use this, user can select only the reusable actions.
4. If we have to reuse an action as it is without any modification, we should go for this.

Call to Copy
1. In this all the resources like source code, data table contents & object repository contents are editable
2. If source action is modified, it will not have impact on the target script as it is making a copy with the target.
3. While trying to use this, user can select both reusable & non-reusable actions
4. If we have to reuse an action with any modification, we should go for this.

Split Actions: 
Split is used to divide an action into two parts & while splitting we can specify whether the actions should be independent or Nested.
(Action2 being called from Action1 is called Nested)

Steps to split an Action:
1.Select the required action from the drop-down in expert view
2.Select Edit --> Action --> Split Action
3.Click on Yes to confirm the split
4.Provide the names for the splitted actions
5.Select whether the action is to be independent or nested
6.Click on OK

Note: When we split an action, the data table contents & object repository contents are maintained separately for the splitted actions. (Infact object repository will be duplicated for the two actions.

Delete Actions:

Steps to delete an action:
1.Select the required action from the drop-down in expert view
2.Select Edit --> Action --> Delete
3.Click on Yes to confirm the delete

3 comments:

  1. Thanks for your information. QTP provide most precise and independent review about a software application. This automation testing tool is ideal to determine the performance and validity of a software application.

    ReplyDelete