Understanding the Script Test Tool

Civic Platform provides the Script Test tool to test EMSE scripts. The Script Text tool simulates script execution by running scripts and displaying the resulting output. However, scripts run in the Script Text tool do not change any values in Civic Platform, Citizen Access, or the Civic Platform database.

You can use the Script Test tool to:

  • Develop and test batch scripts.

  • Develop and test custom functions.

  • Troubleshoot and debug EMSE scripts.

Note: The JavaScript framework (introduced in Civic Platform 8.0.1) allows you to use a Script Tester utility to test new or converted scripts without using the legacy Standard Choice script controls . See JavaScript Scripting Framework and Testing Scripts.

To access the Script Test tool

  1. From the Classic Admin portlet, click Admin Tools > Events > Script Test.

    Civic Platform displays the Script Test interface.

    Figure: Script Test

Script Test Field Definitions provides information on the fields in the Script Test interface.

Table 1. Script Test Field Definitions
Script Transaction A drop-down list that provides two options:
  • Always Rollback. The script outputs results to the Script Output window, but does not commit actions in Civic Platform. For example, if the script updates a workflow task for each license that meets certain criteria, the Script Output window indicates an updated workflow task while the status of the record in Civic Platform remains unchanged. The Always Rollback selection does allow scripts to affect autonumbers for Civic Platform objects. For example, if the script assesses and invoices a fee item, the sequence numbers for fees and invoices increments even though Civic Platform did not create the fee as a part of the script test.
  • Commit if SuccessfulThe script commits requested actions in Civic Platform and displays a result message in the Script Output window.
Script Initializer Contains initialization requirements for testing the script. For example, when testing a batch script, you can set batch script parameter values, like specifying an email address, to set the scope of the batch script to a record type designation. You can also set script initialization values in Script Text.
Script Text Contains the contents of the script. In general, you should create scripts in a text editor, then copy and paste them into the Script Test section.
Script Output Contains the returned output upon the completion of the script execution. The script only displays text strings it sends to the aa.print method (“This should be sent to the Script Output window”). If your script contains the logMessage or logDebug function, make sure you send the variable that contains the debug or message output to the aa.print method (Using the aa.print Function).

Scripts that run longer than the specified EMSE time-out do not exit as gracefully as they do from a batch job or a set script execution.

Script errors display in the next encountered error pop-up window as well as the Script Output section.

The first couple lines of an error message often indicate an undefined variable or a non-existent function.

The error message typically the line in the script where the error occurred.