FoneMonkey Quick Tutorial
This QuickStart demonstrates using FoneMonkey with Apple's sample application, TheElements. By following along, you should be you up and running with FoneMonkey in a matter of minutes!
Preparing Your Application For Testing
Before you can begin using FoneMonkey, you must link the FoneMonkey framework into your application.
Starting FoneMonkey with Your Application
Once your application has been linked with the framework, whenever you launch your application the FoneMonkey console will "drop down" in front.
Click the Record button to hide the console and begin recording. FoneMonkey will record most user interface event types including touching, dragging, scrolling, and typing. If you stop interacting with the application for more than the timeout interval (2.5 seconds by default), the FoneMonkey console will again be displayed.
Touch the More button to display the recorded commands.
Touch the Play button to play the script. The FoneMonkey console will hide and FoneMonkey will generate user interactions corresponding to each recorded command. It is important to note that FoneMonkey will not automatically restore your application to its starting state before playing a script. The application must be in a state such that the script makes sense. For example, TheElements has tabs that display the table sorted by element name or symbol. If you record a script that assumes the application is displaying the the Name tab when it begins, you must ensure the Name tab is being displayed before playing the recorded script. One way to do this is to record touching the Name tab as the first action in the script.
You can touch the Pause button to hide the console and manipulate your application without recording.
Video of Recording and Playback
Adding Verification to The Script
You can add Verify commands to a script to test the values UI component properties or the values of associated object properties (ie, you can use a key-value encoded key path) . To insert a Verify command, touch the More button to display the current script and then touch the Insert (+) button on the toolbar. Next touch the Insert (+) button on a row to insert a new Verify command and display it in the command editor.
In TheElements sample application, a custom class called AtomicElementView is used to display data for the currently selected element. The AtomicElementView has a property called element that references an instance of the AtomicElement class, which in turn as a property called name. In the Verify command below, we test that the current AtomicElementView's element.name has a value of "Lead".
Touch the Play button to run the script. When the script finishes running, any faiiled verifications will be displayed in red with along with explanatory text.
You can save a script for later replay by clicking on the Save button (the downarrow) on the toolbar.
Video of Inserting a Verification Command And Saving a Script
Waiting for Some Condition to Become True
The WaitFor command is similar to the Verify command, except it pauses script execution until the specified condition becomes true.