通过 UIA 脚本访问 iOS 用户首选项以实现 UI 自动化 [英] Accessing iOS user preference through UIA script for UI automation
问题描述
我一直在尝试为我的 iOS 应用程序实现 UI 测试脚本.在测试用例中,我遇到了在设置中设置用户偏好的问题.到目前为止,我找不到更改或读取这些用户首选项值的方法.
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.
这些是我目前学到的:
- setPreferencesValueForKey 和preferencesValueForKey 在Root.plist 中使用标识符作为搜索键不起作用.它将返回空值.但是,我可以通过 UIA 脚本添加这些值,模拟器似乎记住了它们,但它自己的应用程序并没有注意到这些变化.
- 在 Setting.bundle 中尝试设置 ON 和 OFF 的值,没有帮助.
我的环境:
- 我使用的是 Xcode 4.3.2 版本,其中嵌入了其中的仪器.
- Mac OS X 10.7.3
- iPhone 5.1 模拟器
有任何想法吗?提前感谢您提供所有建议、评论和解决方案 =)
Any thoughts?, thank you in advance for all advises, comments and solutions =)
推荐答案
Approach describe only 适用于在 iOS 设备上运行它在 iOS 模拟器上不起作用.所以我只是使用实际设备来运行测试脚本!这就是我的解决方案!
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!
这篇关于通过 UIA 脚本访问 iOS 用户首选项以实现 UI 自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!