【问题标题】:UIAutomation with bwoken and tuneupJS带有 bwoken 和 tuneupJS 的 UIAutomation
【发布时间】:2015-01-14 13:20:20
【问题描述】:

我正在尝试使用 bwoken 和 tuneupJS 设置我的 UIAutomation。我按照here 列出的安装步骤操作,除了我安装了 2.1.0rc.2 版本以摆脱 Xcode 6 中的模板路径更改。因此我的 Gemfile 看起来像这样:

# A sample Gemfile
source "https://rubygems.org"

# gem "rails"
gem 'bwoken', '2.1.0.rc.2'
gem 'cocoapods'

我编写了一个简单的测试,只是为了看看我在运行它时是否在控制台中得到任何东西:

#import "../../../../Pods/tuneup_js/tuneup.js"

test("Example test", function(target, app) {
     var searchButton = target.frontMostApp().mainWindow().buttons()["Search Button"];
     assertTrue(searchButton.isValid(), "Search Button should be available on the screen");
     searchButton.tap();

     var saveSearchButton = target.frontMostApp().mainWindow().buttons()["Save"];
     assertTrue(saveSearchButton.isValid(), "Save Button should be available on the screen");
     saveSearchButton.tap();


     searchButton.tap();

     // tap on the background
     target.frontMostApp().mainWindow().buttons()[7].tap();


     searchButton.tap();
     saveSearchButton.tap();
     });

这是我回来的:

Building......................................................................
Build Successful!

iphone  FirstScript.js

ipad    FirstScript.js

FirstScript.js 是我粘贴的测试脚本。这看起来不对,我假设我应该得到更详细的输出,就像 bwoken github 页面上示例中的输出一样。所以问题是:我在这里遗漏了什么,我哪里出错了,所以我的测试没有执行?

我在玩bwoken的时候还发现了一些其他的问题:

  1. 当我尝试使用 --verbose 标志时,唯一发生的事情是 构建,没有输出表明任何测试已开始。
  2. 当我使用 --skip-build 标志时,它似乎没有任何效果,工作区仍在构建中
  3. 我错过了一些关于#github 指令的文档,即如何导入使用#github 获得的文件?它们在哪里下载?

编辑: 我尝试直接使用 Instruments 命令运行相同的命令,它似乎工作正常:

2014-11-17 16:08:00 +0000 开始:示例测试 2014-11-17 16:08:01 +0000 调试:target.frontMostApp().mainWindow().buttons()["Search Button"].tap() 2014-11-17 16:08:01 +0000 调试:target.frontMostApp().mainWindow().buttons()["Save"].tap() 2014-11-17 16:08:01 +0000 调试:target.frontMostApp().mainWindow().buttons()["Search Button"].tap() 2014-11-17 16:08:03 +0000 调试:target.frontMostApp().mainWindow().buttons()[7].tap() 2014-11-17 16:08:03 +0000 调试:target.frontMostApp().mainWindow().buttons()["Search Button"].tap() 2014-11-17 16:08:04 +0000 调试:target.frontMostApp().mainWindow().buttons()["Save"].tap() 2014-11-17 16:08:04 +0000 通过:示例测试

仪器跟踪完成(持续时间:7.199495 秒;

输出:/Users/me/Documents/Project/MyApp/instrumentscli8.trace)

【问题讨论】:

    标签: xcode testing instruments ui-automation ios-ui-automation


    【解决方案1】:

    我在bwoken GitHub repository issues section 中发现了类似的问题。

    您需要做的是通过以下方式查找可用设备:

    instruments -s
    

    这将打印类似于此的可用设备列表:

    Known Devices:
    Jakub’s MacBook Pro [FFBE27F6-3076-59B7-B14F-40E92F1366FD]
    iPad (7.1.2) [07056cc29131036c74d215ba52a9be605dc9e64a]
    Resizable iPad (8.1 Simulator) [26038DBD-791C-421E-99F4-9153CA726A2F]
    Resizable iPhone (8.1 Simulator) [31B2F0AE-3547-4189-A561-CD2088F6C645]
    iPad 2 (8.1 Simulator) [683233C4-EC2B-48A3-826B-10EF62A875CD]
    iPad Air (8.1 Simulator) [6358A6F5-2FD0-4377-BD32-0A2C3329276D]
    iPad Retina (8.1 Simulator) [224533ED-94DA-46CC-B1DB-1781A1C80710]
    iPhone 4s (8.1 Simulator) [D114BC7E-A913-4063-A349-C119BAFC06DA]
    iPhone 5 (8.1 Simulator) [7AF6D6F4-C6BC-4A47-B83C-3A4B43ABE0DD]
    iPhone 5s (8.1 Simulator) [BE82D607-466A-43E5-863D-6A05F217C117]
    iPhone 6 (8.1 Simulator) [D183FF05-3023-4FB5-BEA0-290EA881040A]
    iPhone 6 Plus (8.1 Simulator) [0AFCC9AB-7C59-48C7-9BFB-FBF4865B7A63]
    

    请注意 MacBook Pro 是第一个条目,据称这是这里的根本问题。现在,您可以通过调用来解决它:

    bwoken test --device D183FF05-3023-4FB5-BEA0-290EA881040A
    

    我希望这对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2010-11-03
      • 2012-10-06
      • 2013-09-25
      • 2019-08-03
      • 1970-01-01
      • 2016-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多