Information Technology Reference
In-Depth Information
Creating a test script
In Xcode 3, you could load a script before launching the Automation instrument. It's possible Xcode 4 will re-
store the same approach at some point in the future, but at the time of writing scripts are managed in a less el-
egant and intuitive way.
The easiest way to create a test script is to create an empty file with a .js extension using an editor such as Tex-
tEdit. You can save the file anywhere. Your project directory is a good location because it guarantees you'll be
able to find it later. Optionally you can include some test code in the file, but you'll be editing this file later
within Instruments, so it's convenient to leave the file blank until you do that.
NOTE
Even though Automation files can be loaded into Instruments and saved in a project directory, they're not part of
the project's code base. You can't edit them with the main Xcode editor, and there's no reason to add them to a
build.
Launching the Automation instrument
Select Product⇒Profile and choose the Automation instrument, as shown in Figure 16.30.
FIGURE 16.30
Selecting the Automation instrument
At the time of writing this launches the instrument, and immediately begins recording—nothing. No script is
selected, so Automation simply fills the time line with a blank rectangle.
Click the Stop button to stop the run. Wait while Instruments resets itself, then select the Choose Script option
from the menu, as shown in Figure 16.31. Click Choose Script again and navigate to your script file in the file
selector to load it.
Search WWH ::




Custom Search