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();
      
  • 相关阅读:
    在Eclipse中设置中文JavaDOC
    买车,给点建议和意见
    父亲节
    JSP文件上传

    昨天我生日
    换皮了
    西安夕阳
    WinForms中只能输入数字的文本框
    使用GoogleCode SVN服务
  • 原文地址:https://www.cnblogs.com/caker/p/3970939.html
Copyright © 2011-2022 走看看