One of the big reasons to use tuneup is to give some structure to your
UIAutomation tests. Out of the box, UIAutomation doesn’t provide a real
first-class way of grouping test code together, so tuneup provides the
The 'test' Function
test function takes two arguments: a short description of your
used by UIAutomation to provide feedback about which test executed. Tuneup passes
this string along in such a way that the output from Instruments will be grouped
by this string within the trace document generated by Instruments.
The function takes two parameters, typically named
target. The first is a reference to the
instance variable for your application, the second is a reference to the
UIATarget pointing to the current target. These are provided to
avoid extraneous the boilerplate code required by every UIAutomation test.
Test Function Bodies
UIAutomation tests typically alternate between exercising the UI in some fashion, then making assertions about its current presentation and state. You exercise the UI using UIAutomation’s built-in API, you validate the UI using tuneup’s library of assertions.
You can declare as many tests in a single file as you see fit. However, for maintenance and readability reasons, you should consider grouping tests into a single file that all relate to the same feature of the application. For example, you may have a login screen to your application that needs to be tested when a user successfully logs in, unsuccessfully logs in and when the backend server is unavailable. You could structure each of these cases in separate test declarations all within a single file.