Tuesday, 28 June 2011

Automating User Interface Testing with Instruments



Automation Script
User has to write the tests in JavaScript, using the user interface automation API to specify actions that should be performed in your application while it runs on a connected device.
The test script must be a valid executable JavaScript file accessible to the instrument on the host computer. User can create as many scripts as he likes.
The API offers a #import directive that allows you to write smaller, reusable discrete test scripts. For example, if you were to define commonly used functions in a file named TestUtilities.js, you could make those functions available for use in your test script TestXYZ.js by including in that script the line
How to Launch the Automation Instrument:-
With minor variations, you launch the Automation instrument much the way you would any other built-in instrument. The following procedure steps through the process:
  1. Launch the Instruments application and choose the Automation template to create a trace document. (Alternatively, you can find the Automation template in the UI Automation category of the template library.)
  1. Click the center button in the Primary View controller to select the detail view.
In the Target menu, choose iPhone, then choose your application from the list of iOS applications.

Running the Automation Instrument
To run the Automation instrument, follow these steps:
  1. Click the Script disclosure triangle, if necessary, to display the contents of that pane.
  2. Click Choose Script.
  1. In the Open panel, locate the script file and open it.
  1. Click the Record button in the Instruments toolbar. Script log entries begin to appear in the Detail pane.
  2. Click any script log entry in the Detail pane to reveal more information for that entry in the Extended Detail pane.
Use the stop and start script control buttons to stop/pause and start/resume execution of your test sequence script.
To configure Automation to automatically start and stop your script under control of the Instruments Record button in the toolbar, select the Run on Record checkbox.
If your application crashes or goes to the background, your script is blocked until the application is frontmost again, at which time the script continues to run.
Note: - The user must explicitly stop recording. Completion or termination of your script does not turn off recording.


References:-




No comments:

Post a Comment