Search code examples
iphoneautomationscreenshot

How can I run automated tests that support real iOS devices, take screenshots, and identify controls by ID?


I need to run some automated UI checks on our native iPhone app. I'd like to be able to do the following:

  • I'd like to automate a few actions and take screen shots.

  • I don't want the tool to identify the buttons by image or text, as my app changes images and text all the time. I'd like to identify controls by ID.

  • I'd like to run these tests on a real iPhone device.

  • Lastly, when I complete one test, I need to access to settings to modify a few changes, then relaunch app to test. (no need to resume the app)

Is there a good way to achieve these kinds of automated UI tests?


Solution

  • You can use the instrument that apple provides - UIAutomation It provides all expected automation facilities. Screenshots can also be taken. Check for documentation here apple doc

    Here is a nice tutorial to start with http://cocoamanifest.net/articles/2011/05/uiautomation-an-introduction.html