博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Xcode 使用Instrument(1)
阅读量:6977 次
发布时间:2019-06-27

本文共 850 字,大约阅读时间需要 2 分钟。

UIAutomation

UIAutomation是随iOS4.0系统一起发布的一款旨在iPhone Device/Simulator上可执行的自动化测试框架。

使用UIAutomation准备

  • 被测试app源代码
  • 了解JavaScript

开始使用

  • 测试脚本的导入
    1. 使用Xcode打开被测试app工程
    2. command + i 打开Instrument
    3. 选择Automation template ->profile
      141247390123688.jpg
    4. command + R 停止 profile
    5. 找到scripts 选择 add->import...
      141249564657730.jpg
    6. 选择写好的测试脚本后会看到脚本list
      141310448097586.jpg
    7. 在脚本list右边script可以看到脚本内容
      141311547629548.png
    8. command + R执行脚本
      141312521991135.png
    9. 可以看到脚本测试log

    附上一个显示遍历UI元素树的脚本,保存为本地的showUIAElementTree.js

    DEMO_DELAY=2;var target = UIATarget.localTarget();var app = target.frontMostApp();//test functionsfunction showCurrentViewInfo(){    UIALogger.logStart("show CurrentViewInfoTree");        try{            //show the target logElementTree            target.logElementTree();            UIALogger.logPass();        } catch(error){            UIALogger.logFail(error);        }    }//calling test functionsshowCurrentViewInfo();

转载于:https://www.cnblogs.com/caker/p/3970939.html

你可能感兴趣的文章
功能演示:戴尔PowerConnect 8024交换机VLAN的创建与删除
查看>>
SharePoint运行状况分析器有关磁盘空间不足的警告
查看>>
Oracle的分页查询
查看>>
Objective-C非正式协议与正式协议
查看>>
jquery mobie导致超链接不可用
查看>>
Python OpenCV学习笔记之:图像读取,显示及保存
查看>>
计算机职业目标
查看>>
2月国内搜索市场:360继续上升 百度下降0.62%
查看>>
HTML样式offset[Direction] 和 style.[direction]的区别
查看>>
使用memcache做web缓存
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
华胜天成ivcs云系统初体验2
查看>>
MASQUERADE --random 端口不随机
查看>>
阿里云 Aliplayer高级功能介绍(二):缩略图
查看>>
从1.5K到18K 一个程序员的5年成长之路(二)
查看>>
从HelloWorld看Knative Serving代码实现
查看>>
制作一个简单的linux
查看>>
【ZooKeeper Notes 14】数据模型
查看>>
Expect自动化控制简单介绍
查看>>