Insert a call to such source action using any of the following methods:
- QTP Graphical User Interface (GUI):
1. Go to Insert menu, then select "Call to Existing Action" (or "Call to Copy of Action")
Note: A "Call to Existing Action" inserts a link to the Action in the original script. A "Copy of Action" inserts a copy of the Action into the new script.
2. Browse to the first script in the "From test" field.
3. Select the Action(s) you want.
4. Select the location where the Action should be inserted.
5. Click <OK>.
- Programmatically. Starting with QuickTest Professional 10.0, the statementLoadAndRunActionwas implemented, loading during run-time the dedicated resources of a reusable action to main test.
LoadAndRunAction "C:\MyTest", "Action1", OneIteration
By design, an Action has dedicated resources used during replay, specifically a script, a local repository (can only be modified directly from source test storing the action) and a Data table sheet (only one denominated as "local sheet", not "global sheet") with same name as action (name of source test script is displayed between brackets).
Action’s Data Table Sheet Notes:
- Iterations: Action will iterate X amount of times after desired configuration from "Action Call Properties" dialog (right click on action under Test Flow Pane), under "Run" tab. To run action depending how many rows sheet has, setup "Run on all rows" for "Data Table iterations" option.
- Access to data on sheet: When script is running through an action’s code, this sheet can be accessible by using statements such as
DataTable("A", dtlocalsheet) = CSTR(Now)