zoukankan      html  css  js  c++  java
  • Xcode 使用Instrument(1)

    UIAutomation

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

    使用UIAutomation准备

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

    开始使用

    • 测试脚本的导入

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

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

      DEMO_DELAY=2;
      var target = UIATarget.localTarget();
      var app = target.frontMostApp();
      
      //test functions
      
      function showCurrentViewInfo(){
      	UIALogger.logStart("show CurrentViewInfoTree");
      		try{
      			//show the target logElementTree
      			target.logElementTree();
      			UIALogger.logPass();
      		} catch(error){
      			UIALogger.logFail(error);
      		}
      	}
      
      //calling test functions
      showCurrentViewInfo();
      
  • 相关阅读:
    垃圾处理现状
    买了个学生阿里云114元啊,安装mysql
    4 存储器
    3 总线
    崔大哥说基础很重要
    idea使用小积累mac
    为啥要用left join on where这样的东西
    观察者模式
    从shell中退出python命令
    locust性能测试入门
  • 原文地址:https://www.cnblogs.com/caker/p/3970939.html
Copyright © 2011-2022 走看看