iOS unit test: How to set/update/examine firstResponder?
How do you write first responder unit tests? I'm trying to write a test to confirm that a method advances focus to the next text field. controller is a descendant of UIViewController . But this exploratory test fails: - (void)testFirstResponder { [controller view]; [[controller firstTextField] becomeFirstResponder]; STAssertTrue([[controller firstTextField] isFirstResponder], nil); } The first line causes the view to be loaded so that its outlets are in place. The text fields are non-nil. But the test never passes. I'm guessing that becomeFirstResponder doesn't set the first responder right