Knowledge Share
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Knowledge Share

Knowledge is NOT Power IMPLEMENTATION of knowledge is Power!!!
 
HomePortalGalleryLatest imagesRegisterLog in

 

 QTP Notes

Go down 
AuthorMessage
Admin
Admin



Posts : 142
Points : 59334476
Reputation : 0
Join date : 2007-12-29
Location : Chennai

QTP Notes Empty
PostSubject: QTP Notes   QTP Notes Icon_minitimeMon Dec 01, 2008 10:07 am

6.0 Creating Tests with Multiple Actions
6.1 Benefits of Test Modularity
· Makes code reusable.
· Scripts are easy to maintain.
· Scripts are efficient.
· Saves development time.
6.2 Creating Tests with Multiple Actions

You can divide your test into multiple actions by creating new actions or by inserting existing actions. There are three kinds of actions:
· Non-reusable action—an action that can be used only in the test in which it was created, and only once.
· Reusable action—an action that can be called multiple times by the test in which it was created (the local test) as well as by other tests.
· External action—a reusable action created in another test. External actions are read-only in the calling test. They can be modified only in the test in which they were created.
6.2.1 Creating New Actions

You can add new actions to your test during a recording session or while designing your test.
You can add the action as a top-level action, or you can add the action as a sub-action (or nested action) of an existing action in your test.

To create a new action in your test:
If you want to insert the action within an existing action, click the step after which you want to insert the new action.
· Choose Insert > New Action or click the New Action button. The Insert New Action dialog box opens.
· Type a new action name or accept the default name.
· If you wish, add a description of the action. You can also add an action description at a later time in the Action Properties dialog box.
· Select Reusable Action if you want to make the action reusable. You can also set or modify this setting at a later time in the Action Properties dialog box.
· Decide where to insert the action and select At the end of the test or After the current step.
· Click OK.


A new action is added to your test and is displayed at the bottom of the test tree or after the current step. You can move your action to another location in your test by dragging it to the desired location.
6.2.2 Inserting Existing Actions
You can insert an existing action by inserting a copy of the action into your test, or by inserting a call to the original action.
6.2.2.1 Inserting Copies Actions
When you insert a copy of an action into a test, the action is copied in its entirety, including checkpoints, parameterization, and the corresponding action tab in the Data Table. The action is inserted into the test as an independent, non-reusable action

Once the action is copied into your test, you can add to, delete from, or modify the action just as you would with any other recorded action. Any changes you make to this action after you insert it affect only this action, and changes you make to the original action do not affect the inserted action. You can insert copies of both reusable and non-reusable actions.

Steps to insert a copy of an action:
· Choose Insert > Copy of Action, right-click the action and select Insert Copy of Action, or right-click any step and select Action > Insert Copy. The Insert Copy of Action dialog box opens.
· Type a meaningful name for the action in the New action name box and give action description
· Specify where to insert the action : At the end of the test or After the current step.
· Click OK. The action is inserted into the test as an independent, nonreusable action.
6.2.2.2 Inserting Call to Actions

You can insert a call (link) to a reusable action that resides in your current test (local action), or in any other test (external action).

When you insert a call to an external action, the action is inserted in read-only format. You can view the components of the action in the action tree, but you cannot modify them.
Steps to insert a call to an action:
· Choose Insert > Call to Action, right-click the action and select Insert Call to Action, or right-click any step and select Action > Insert Call. The Insert Call to Action dialog box opens.
· In the Select an action box, select the action you want to insert from the list.
· Specify where to insert the action : At the end of the test or After the current step.
· Click OK. The action is inserted into the test as a call to the original action
6.2.3 Nesting Actions
Sometimes you may want to run an action within an action. This is called nesting.

Nesting actions Help you maintain the modularity of your test. Enable you to run one action or another based on the results of a conditional statement.

6.2.4 Splitting Actions
You can split an existing action into two sibling actions or into parent-child nested actions.
You cannot split an action and the option is disabled
· When an external action is selected
· When the first line of the action is selected
· While recording a test
· While running a test
· When you are working with a read-only test
6.3 Miscellaneous
6.3.1 Setting Action Properties
The Action Properties dialog box enables you to modify an action name, add or modify an action description, and set an action as reusable.
6.3.2 Sharing Action Information
There are several ways to share or pass values from one action to other actions:
· Store values from one action in the global Data Table and use these values as Data Table parameters in other actions.
· Set a value from one action as a user-defined environment variable and then use the environment variable in other actions.
· Add values to a Dictionary object in one action and retrieve the values in other actions.

6.3.3 Exiting an Action
You can add a line in your script in the Expert View to exit an action before it runs in its entirety.
There are four types of exit action statements you can use:
· ExitAction - Exits the current action, regardless of its iteration attributes.
· ExitActionIteration - Exits the current iteration of the action.
· ExitRun - Exits the test, regardless of its iteration attributes.
· ExitGlobalIteration - Exits the current global iteration.

6.3.4 Removing Actions from a Test
We can temove Non-reusable actions, External Actions, Reusable Actions, or Calls to External or Reusable actions.
6.3.5 Renaming Actions
You can rename actions from the Tree View or from the Expert View.
6.3.6 Action Template
If you want to include one or more statements in every new action in your test, you can create an action template.

Steps to create an action template:
· Create a text file containing the comments, function calls, and other statements that you want to include in your action template.
· Save the text file as ActionTemplate.mst in your <QuickTest Installation Folder>\dat folder.
Back to top Go down
https://knowledgeshare.forumotion.com
 
QTP Notes
Back to top 
Page 1 of 1
 Similar topics
-
» QTP Notes
» QTP Notes
» QTP Notes
» QTP Notes
» QTP Notes

Permissions in this forum:You cannot reply to topics in this forum
Knowledge Share :: Testing :: Automation-
Jump to: