Running Other Scripts and Handlers
Writing other scripts and handlers outside of the main script for your test allows you to create reusable chunks of code, effectively modularizing your test. But, how do you call those scripts and handlers once they're written? This page explains how, and then provides some related commands and functions.
Calling a Local Handler or Script
Calling a Handler or Script as a Command
Syntax:
scriptOrHandlerName {parameters}
To call another handler within your script, simply use the handler name as a command, along with any needed parameters. For example, consider this command:
recordScores 2017, rawScores
If there is a "to" (or "on") handler in the local script for the recordScores
message, this command will run that handler, passing it two parameters.
If there is no local handler for the recordScores
command, but there is a script by that name, that script (meaning, the script's initial handler) will be run, passing it the two parameters. So in either case, to call a handler in the local script, or another script in the same directory, all that is needed is to use that handler or script name as a command.