Specifications
3. Click the "View declaration/fixture pane" tool button to reveal the Fixture pane.
4. In the Fixture pane, configure the basic fixture settings, the incoming jobs and the outgoing
connections to reflect a relevant test scenario. If the script accesses information in the internal
job ticket of incoming jobs, setup the corresponding test data as well.
5. To simulate the arrival of a job on one of the script's incoming connections, select the desired
job in the Fixture pane (make sure it is enabled). Then select the "jobArrived" entry point
using the selector in the toolbar and press the "invoke entry point" tool button. The selected
job is passed to the script's "job" argument and all enabled jobs are returned when the script
requests a complete list of incoming jobs (disabled jobs are hidden from the script).
6. To simulate a timer event, select the "timerFired" entry point using the selector in the toolbar,
and click the "Invoke entry point with the test fixture" tool button. Again, all enabled jobs
are returned when the script requests a complete list of incoming jobs.
7. In the Messages pane, review the messages issued by SwitchScripter and by the script to
evaluate the script's operation. Also, use the Environment.log() and Job.log() functions to
generate messages for debugging.
8. If desired, adjust the script program and/or the script declaration and start over.
Other entry points
Test any of the supported entry points with a similar procedure. If an entry point that requires
an extra argument (such as a property tag, for example) is selected, SwitchScripter displays a
dialog for entering the argument value when the "Invoke entry point with test fixture" button
is clicked.
Execution mode
SwitchScripter ignores the script's execution mode property. Entry points are always invoked one
at a time and data is not persistent between entry point invocations.
While testing a script with persistent execution mode, insert explicit calls to the initializeProcessing
and finalizeProcessing entry points from within the jobArrived and timerFired entry points. Do
not forget to remove those calls before deploying the script in Switch.
For a script, users can select three types of execution modes:
• Serialized
• Concurrent and
• Persistent
Testing a script expression
A script expression is a brief JavaScript program used to calculate the value of a flow element
property. Even though users can enter a script expression in a property editor dialog within
PowerSwitch, they still need a SwitchScripter to test a complex script expression:
1. Create a new empty script package and save it with an appropriate name in an appropriate
location.
2. Enter the script expression in the JavaScript tab of the Program pane (leave the default entry
points in place but it is cleaner to remove them).
343
Enfocus Switch 10