Search code examples
iphoneiosunit-testingxcode4

How do I write an Application Test that tests that when a button is pressed, a particular view is shown?


I'm looking at apple's example code for application tests, and it all involves changes within a particular view. I'd like to write a test which asserts the following:

Given that I am seeing the Results view,
And I press the button for the first result,
Then I should see a Detail view,
And its controller's result property should be set to the first result

How would I go about writing that test case?


Solution

  • You could also look at the an open-source integration testing framework which has been published by the good people over at Square. Looks like it could help you automate some if the UI-level interaction tests that you seem to be interested in.

    I haven't used this framework myself, but have been meaning to check it out.

    http://corner.squareup.com/2011/07/ios-integration-testing.html

    Hope this helps.