Database Reference
In-Depth Information
One thing you can do is to throw other instruments such as memory leak detectors on
in parallel with your automation test, which will allow you to profile your application
over time to make sure you don't introduce issues down the road.
Because of the awkwardness, fragility, and slowness of the framework, it would be nice
if there were alternatives, and there are. They just aren't officially supported.
UI Testing Using OCUnit
In theory, now that OCUnit tests run in the simulator, you could write your UI tests
using OCUnit and be done with the UIAutomation framework. The only problem is
that until recently, if you tried to do this, you'd get a message saying that testing UI
with OCUnit was only supported on physical devices. In other words, if you wanted
to do this, you'd need to run it with a tethered phone or pad attached, which is pretty
non-optimal.
Recently, things have changed. Now, if you create a Cocoa Touch Unit Testing Target,
and then go into the build settings for the target and set the Test Host parameter to
$(BUNDLE_LOADER) , you can run tests that directly manipulate the UI. You can see how
this is set in Figure 5-9 .
Figure 5-9. Setting the test host
With the tests set to run against the test host, we can now write UI OCUnit tests, such
as the one in Example 5-5 .
Example 5-5. A Cocoa Touch unit test
#import "BuggyWhipChatTests.h"
#import "BuggyWhipChatAppDelegate.h"
#import "RootViewController.h"
#import "DetailViewController.h"
@implementation BuggyWhipChatTests
 
Search WWH ::




Custom Search