Think unit tests and UI code don’t mix?
People assume you can’t write unit tests for user interface code. That just ain’t so. I’ve already shown you how to do UIViewController TDD. Can we do the same for UIAlertView and UIActionSheet? Sure!
Jon also includes a github project:
The example project includes two versions of the tests: one in plain OCUnit, and one using OCHamcrest. OCHamcrest is not required — but compare the test code (especially checking the otherButtonTitles NSArray) and you’ll see why I prefer it.