正文

action2

(2011-06-08 10:51:39) 下一个

Action and Test Iterations Using the Data Table
When you use the data table to output a value or to add a parameter to your test or action, you can specify whether to store the data in the Global data sheet or in the action data sheet.
Global sheet. Enables you to define parameters for any action. When you run your test, QuickTest inserts or outputs a value from or to the current row of the Global data sheet during each global iteration. This enables you to pass information between actions
Action sheet. Enables you to insert data that applies only to that action.

See example: 527 and 528

Considerations for Working with Actions
Inserting Actions
➤ If you plan to use an identical or virtually identical procedure in more than one test, you should consider inserting a call to an action from another test.
➤ If you want to make slight modifications to the action in only one test, you should use the Insert Call to Copy of Action option to create a copy of the action.
➤ If you want modifications to affect all tests containing the action, you should use the Insert Call to Existing Action option to insert a link to theaction from the original test.
➤ If you want modifications to the action to affect all tests containing the action, but you want to edit data in a specific test’s data table, use the Insert Call to Existing Action option and, in the External Action tab of the Action Properties dialog box, select Use a local, editable copy.
Organizing Actions in Your Test
➤ If your action runs more than one iteration, the action must end at the same point in your application as it started, so that it can run another iteration without interruption.


Your entire test runs one time for each row in the Global data sheet. Within each test, each parameterized action is repeated according to the number of rows in its data sheet and the run settings selected in the Run tab of the Action Properties dialog box.

Calls to Existing Actions and Copies of Actions
You can insert calls to an existing action by inserting a call to a copy of the action, or by inserting a call to the original action.
You can also call actions dynamically during a run session using the LoadAndRunAction statement.

Calls to Copies of Actions
When you insert a call to a copy of an action into a test, the original action is copied in its entirety, including checkpoints, parameterization, the corresponding action tab in the data table, plus any defined action parameters. If the test you are copying has objects in the local object repository, the copied action’s local object repository is also copied together with the action.
The action is inserted into the test as an independent, non-reusable action (even if the original action was reusable). After the action is copied into your test, you can add to, delete from, or modify the action just as you would with any other non-reusable 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 copied action.

Calls to Existing Actions
You can insert a call to a reusable action that is stored in your current test (local action), or in any other test (external action). Inserting a call to an existing action is similar to linking to it. You can view the steps of the action in the action view, but you cannot modify them. The called action’s local object repository (if it has one) is also read-only. If the called external action has data in the data table, however, you can choose whether you want the data from the action’s data sheet to be imported as a local, editable copy, or whether you want to use the (read-only) data from the original action. To modify a called, external action, you must open the test with which the action is stored and make your modifications there. The modifications apply to all tests that call that action.


Action Parameters
Action parameters enable you to transfer input values from your test to a top-level action, from a parent action to a nested action, or from an action to a sibling action that occurs later in the test.
You can specify input parameters for an action so that steps in the action can use values supplied from elsewhere in the test.
You can specify output parameters for an action, so that it can return values for use later in the test. For example, you can output a parameter value to a parent action so that a later nested action can use the value.


Sharing Action Information
There are several ways to share or pass values from one action to other actions:
Output Options Dialog Box: Store values in the output action parameters of a called action and use those values in steps that are performed after the action call within the calling action, or in steps within sibling actions.
Using the Global Data Table: Store values from one action in the global data table and use these values as data table parameters in other actions.
Environment Variables: Set a value from one action as a user-defined environment variable and then use the environment variable in other actions.
Dictionary Object: Add values to a Dictionary object in one action and retrieve the values in other actions.

Action Syntax in the Expert View

RunAction ActionName, IterationQuantity

example: RunAction "Select Flight", "1 - 4" # iteration 1-4 in the datatable
RunAction "Action2", oneIteration, "MyValue", MyVariable # using variables
RunAction "Action2", oneIteration, Parameter("Axn1_In"), DataTable("Column1_out", dtLocalSheet)

If the action called by the RunAction statement includes an ExitAction statement, the RunAction statement can return the value of the ExitAction's RetVal argument.
MyRetVal=RunAction (ActionName, IterationQuantity, Parameters)

Delete an action
Reusable action: If multiple action calls exist in the current test, QuickTest removes only the call to this action. Additional calls to the action in this test remain unchanged. The corresponding action sheet in the data table remains unchanged.
If this is only call to this action in the current test, QuickTest deletes the action in its entirety, including its corresponding action sheet in the data table.
Non-reusable action: Deletes the action in its entirety, including its corresponding action sheet in the data table.
External action: Removes the call to the action from the current test without affecting the action in the source test. The original action remains stored with the test in which it was created.

Task: How to Use Actions in Your Test

Insert a call to new action
Insert a call to existing action or copy of action
Modify action properties
Create an action template
Nest an action within an existing action
Remove a call to an action or delete an action
Split an action
Exit an action using programming statements

Action Call Properties Dialog Box
Add pic 552;Run Tab: This tab enables you to instruct QuickTest to run only one iteration on the called action, to run iterations on all rows in the data table, or to run iterations only for a certain row range in the data table.
Add pic 554; Parameter Values Tab:This tab enables you to specify the values of input action parameters used by the called action and to specify the locations in which you want to store output action parameter values

Action Properties Dialog Box
The Action Properties dialog box enables you to define options for the stored action. These settings apply each time the action is called.
General tab; Parameters tab; Associated Repositories tab; Used by tab; External Action tab;

Exit an action using programming statements
Use one of the following exit action statements:
➤ 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.


[ 打印 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.