Script and API Calling
Use the following SenseTalk commands in Eggplant Functional to call other scripts or API tests.
Run
Command
Behavior: Calls another script as if the script were a command. If an error or exception occurs within the called script, the calling script will fail as well. If there is an uncaught exception in the called script, execution will stop.
Parameters: One script name and any parameters values that the called script can receive.
Syntax:
Run scriptName
Example:
Run "Logout Procedure" //Calls a script named "Logout Procedure"
Example:
Run "Login", "SusanG76", "password123!@#" // Calls a script named "Login" with parameter values "SusanG76" and "password123!@#"
Read more about the run command in the SenseTalk Reference documentation.
If the other script is located in the same suite as the current script (or an associated helper suite), and its name begins with a letter and contains only letters, digits, and underscores, you can call it as a command in the current script. (You do not have to use the Run
command, just the name of the script you are calling, followed by any parameters.)
Example:
Login "SusanG76", "password123!@#"
If the script you are calling has a return, you can capture the return using the result
.
Example:
Run "ValidateOutput" // Calls a script named "ValidateOutput" with contents 'return "Test passed!"'
put the result into FormOutput // Stores the string "Test passed!" in a variable