Use the Run Script Routine operation to execute a script function or procedure declared in one of your project’s script units.
There must be no syntax errors in your project’s script units. Otherwise, TestComplete will be unable to parse the script code correctly and get the script routine to run.
The operation returns the same result as the script routine which it calls. For information on how to obtain the result value, see Checking Operation Result.
If the script routine does not return any value, the operation also does not return any value.
This operation is a keyword test analogue for calling a script routine from another script routine.
The operation cannot have child operations.
The operation parameters specify the name of the routine to run and parameters to pass to the routine if it takes any:
When you add the operation to a test, it shows the Select Test dialog, in which you can select the script routine to execute.
If the selected routine has parameters, the operation shows the Operation Parameters dialog in which you can specify their values.
If the routine has no parameters, the operation will not show the dialog.
For Python projects: To learn how to call routines with unspecified number of arguments, see the Remarks section below.
In Python scripts, it is possible to declare routines that take an unspecified number of non-keyword arguments (
*args) or an unspecified number of keyword arguments (
**kwargs). See Python Reference - Arbitrary Argument Lists. When calling such routines, the Run Script Routine operation does not support specifying their arguments. As a workaround, you can do the following:
In your script unit, create an intermediate routine that will use the
evalstatement to call the target routine. For example:
In your keyword test, add the Run Script Routine operation and configure it to call the created intermediate routine. Specify a string value that contains the parameters to pass to the target routine:
You can add the Run Script Routine operation to a test by dragging the needed script unit from the Project Explorer or the needed script routine from the Code Explorer to the desired location in the test.
Note: By default, the Code Explorer panel is hidden from TestComplete. To make the panel visible, select View > Select Panel from the TestComplete main menu, and then select Code Explorer in the resulting Select Panel dialog.