Search code examples
iosui-automationxcode-instruments

Accessing iOS user preference through UIA script for UI automation


I've been trying to implement UI test script for my iOS application. In test cases I come over an issue of setting user's preference in setting. So far I could not find a way to change or read these user preference values.

These are what I have learn so far:

  • setPreferencesValueForKey and preferencesValueForKey doesn't work by using identifier in Root.plist as a search key. It will return null. However, I can add these value via UIA script and the simulator seems to remember them but the application it self doesn't notice these changes.
  • Tried set value for both ON and OFF in Setting.bundle, doesn't help.

My environment:

  • I am using version 4.3.2 Xcode which instrument embedded in it.
  • Mac OS X 10.7.3
  • iPhone 5.1 simulator

Any thoughts?, thank you in advance for all advises, comments and solutions =)


Solution

  • Approach describe only works if running on iOS device where it won't work on iOS simulator. So I just use the actual device to run the test script! And that is my solution!