如何使用UIAutomation进行iOS 自动化测试

如题所述

使用iOS模拟器
1. 载示例应用程序TestAutomation.xcodeproj并打项目简单包含2tabtabbar应用程序
2. 确保选图所示TestAutomation > iPhone 5.0
Simulator模式(或许已经切换5.1能iPhone5.1模拟器)
3. 启Instruments(Product > Profile)或者通?I
4. 选择左边iOS Simulator再选择Automation模板点击Profile
5. Instruments已经启直接始录制先停止录制(红包按钮或者?R)
6. 左边Scripts窗口点击Add > Create创建新脚本
7. 脚本编辑器输入面代码
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
target.logElementTree();
8. 重新运行段脚本?R(需要保存)脚本跑起志打完停止
赞完第UIAutomation测试用例
使用iOS设备
除测试用例运行模拟器运行真实设备自化测试用例能运行支持任务:iPhone 3GSiPadiOS
> 4.0等设备遗憾管iPhone 3G系统版本都支持
面何操作:
1. 通USB接口连接iPhone
2. 选择 TestAutomation > iOS Device模式
3. 确保Developper profile设置Release模式(Ad-Hoc Distribution
profile)默认情况profiling设置Release模式(没必要profile设置Debug模式)
4. 启测试 (?I)
5. 面步骤请参考前面模拟器部
温馨提示:答案为网友推荐,仅供参考
相似回答