Information Technology Reference
In-Depth Information
You can use pre-action and post-action scripts for set-up and tear-down, messaging, and to trigger other arbit-
rary events. Scripts can be shell scripts or AppleScript code. You also can select a pre-written script that sends
an e-mail message.
These are some possible applications of scripts:
Playing a sound at the end of an automated test or debugging run
Copying files generated during testing or debugging to another Mac, uploading them to a server, or e-
mailing them
Launching another application that uses the results of a test run
Using the speech synthesizer to report test results from a run
Bringing some other window to the front of the desktop
If you can write AppleScript, scripting is an immensely powerful feature for automated testing and test report-
ing.
NOTE
For information about AppleScript development, see the companion AppleScript Developer Reference title.
CAUTION
Note that scripting shouldn't be used for basic build control. If you need to set build switches, control which files
are included in a project, or define how they're processed, use the Build Phases feature described in Chapter 13.
Scripting is designed to control what happens after a build, not what happens during a build.
To add a pre-action or post-action script, select an action, click its reveal triangle to show the three optional
stages, and select either the Pre-actions or Post-actions option. By default, you see a message telling you that no
actions are defined. Click the + (plus) icon at the bottom left of the pane, and select either the New Run Script
Action or New Send Email Action option, as shown in Figure 12.14.
For a scripted action, you can either type a script or drag and drop an existing script into the script pane. The
example code in the figure plays one of the system sounds. You can add multiple independent scripts.
For an e-mail action, fill in the e-mail fields. The e-mail message is sent automatically when the script runs.
To remove an action, click the close box at the top left of the script's sub-pane, or select the action by clicking
its title bar. Click the - (minus) icon at the bottom left of the pane to delete it.
FIGURE 12.14
Adding a couple of pre-action scripts
Search WWH ::




Custom Search