Macaca Macaca-iOS 入门那些事

匿名 · 2016年06月08日 · 最后由 AllocAndInit 回复于 2017年03月29日 · 3867 次阅读

原文在这:http://www.cnblogs.com/hyddd/p/5571229.html

一. 前言

最近有朋友向我请教 iOS 自动化测试框架选型,刚好前段时间做讲座时发现了 macaca,遂试用。所以,下面的内容会只围绕 Macaca 的 iOS 部分。

二. Macaca 是什么

阿里的移动端自动测试框架,同时支持 android,iOS。而之前的阿里的 athrun 似乎已经放弃维护了。

官网:https://macacajs.github.io/macaca/

Macaca 基于 Node.js 开发,测试案例编写语言暂时也只支持 Node.js。

三. Macaca 与 Appium 区别

坦白说,这种外部驱动 instruments 的 server-client 自动化测试框架,在 iOS 上实现方式非常受限的,所以其底层的实现方式是一致的。

而在应用级上的封装,二者均采用了 Node.js 作为开发语言,接口也基于 web-driver 实现,所以 Macaca 和 Appium 相似程度非常高。

如何看待 Macaca 和 Appium 区别?

以下是 Macaca 作者的设计思想:

Appium是个优秀的工具。但无法满足更轻、更快、更稳、更易集成、更贴合业务的高要求。

可以认为 Macaca 是一个轻量级的 Appium。当然,这就意味着很多 Appium 的功能会没有了。但这也造就了一个轻量级的,更易集成的框架,Why not?

四. 安装

其实安装是很简单的,但是还是很多人无法把环境搭建起来。这里再详细说下。

  1. Xcode(及 Xcode Command Line Tools)

  2. Node.js

    chentekiMacBook-Pro:~ chenximing$ node -v
    v4.4.3
    chentekiMacBook-Pro:~ chenximing$ npm -v
    2.15.1
    
    • npm 是 Node.js 包管理,之后装 Macaca 就是用它。
  3. brew

至此,如果对以上 3 者不了解,先放弃搭建 Macaca,先把以上东西使用先搞懂....

  1. Macaca 安装

    npm i -g macaca-cli
    

    注意: 这里新是 macaca-cli,如果看旧版教程是:macaca-client(希望之后不要变了...)。

    检查是否安装好了:

    注意:check-list 你未必都能 pass,像我的 Android 部分,platforms directory 检查失败。so what,我只试用 iOS 部分,其他的不鸟它。只要保证:

    node.js checklist
    iOS checklist
    Installed driver list
    

    以上 3 者全 pass 即可。如果按照我刚才的步骤,除 iOS checklist 的 ios-webkit-debug-proxy 外,其他不应该会有 failed。

  2. 安装 ios-webkit-debug-proxy

    brew install ios-webkit-debug-proxy
    

    这里一定要用 brew 安装!之前有些旧文档会略坑新手,手工编译方式....这需要手工安装 N 多依赖:autoconf,libtool,xml2...不是熟手别搞,玩死你...

    ios-webkit-debug-proxy 是干嘛的呢?从它安装的依赖库可以看出:

    libimobiledevice/
    usbmuxd/
    

    iTools 就是使用这玩意儿和 iPhone 通讯的,libimobiledevice 是破解 iTunes 和 iPhone 的通讯后实现的 lib。Xcode5 之前是 fruitstrap,fruitstrap 后来放弃维护,Xcode5 后使用 libimobiledevice。

至此,安装全部完成,很简单是不是:>

五. 运行第一个测试案例

安装完了框架,要跑一跑啊,否则装来干嘛呢?那得先回答以下问题:

  1. 案例哪里来?
  2. 有案例也得有 app...
  3. 运行案例的设备,可以选模拟器和真机。由于装了 Xcode 自带模拟器,所以跑第一个案例时,先用模拟器会比较简单。

然后第 1,2 个问题怎么解决?

作者已经帮你解决了。他已经为你准备第一个测试案例及其对应的 app。

1. 下载案例及 App

git clone https://github.com/macacajs/macaca-test-sample.git --depth=1

如果你不知道什么是 git 或者没装,可以去https://github.com/macacajs/macaca-test-sample下载。

下载后,进入 macaca-test-sample 目录,执行:

npm i

2. macaca-test-sample 目录结构解析

./
├── HISTORY.md
├── LICENSE
├── Makefile
├── README.md
├── app
├── circle.yml
├── macaca-test
├── node_modules
└── package.json
  • app:

    • 存放测试中使用到的 app:ios-app-bootstrap.zip。
  • macaca-test:

    ./
    ├── macaca-desktop-sample.test.js # 桌面浏览器测试案例...作者的想法有点多啊-_-!
    ├── macaca-mobile-browser-sample.test.js # 移动端浏览器测试案例
    ├── macaca-mobile-sample.test.js # 移动端App测试案例
    └── mocha.opts
    

    如果单纯要看 iOS 端 App 测试效果的话,可以把 macaca-mobile-sample.test.js 之外的 *.js 都干掉。

3. 运行第一个测试案例

macaca run --verbose


至此,Macaca 及其案例运行起来了。

共收到 41 条回复 时间 点赞

此文献给初学者...

不错,讲得很详细,适合像我这样的 macaca 新手~

PS:代码建议用代码块,例如:

nam i -g macaca-cli

不要用引用格式。每个代码前面有个 Blockquote 总感觉怪怪的。。。

另:appium 拼错了。。。

匿名 #3 · 2016年06月09日

#2 楼 @chenhengjie123 -_-! 单词打错,好尴尬.....

匿名 #4 · 2016年06月09日

算了,改代码块了。

建议把代码块的样式改深色些,之前不用代码块原因:在显示器看代码块颜色和旁边白色差不多,分辨不出来。这可能跟显示器对比度和 rgb 设置有关。

你们都入坑了啊. 只剩下我这个老顽固了

每次打开文章,只为了看看有没有好玩的评论

#4 楼 @hyddd 考验显示器品质。。。

@hyddd 确定是 iso-webkit-debug-proxy? 我 sb 的复制黏贴了。

匿名 #8 · 2016年06月10日

#9 楼 @zsx10110 谢谢指出,打错了。应该是:ios-webkit-debug-prox,参考看检查图中 iOS checklist。

匿名 #9 · 2016年06月10日

#8 楼 @lihuazhang 我的已经是 dell u 系列..

按照楼主的步骤,ios 模拟器已启动,但在 macaca run 的时候提示没有找到 simulator。我在 macaca-mobile-sample.test.js 设置其他 deviceName,但是 run 还是启动了 iPhone 6s Plus,即使我配置了 iPhone 6s Plus,依然提示找不到 simulator

macaca doctor 的配置如下:

Node.js checklist:

node env: /usr/local/bin/node
node version: v6.2.1

iOS checklist:

Xcode is installed at: /Applications/Xcode.app/Contents/Developer
Xcode Command Line Tools is ready, version: 2343.
ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy

Android checklist:

JAVA version is 1.8.0_91
JAVA_HOME is not set
ANDROID_HOME is not set

Installed driver list:

ios: 1.0.30

匿名 #11 · 2016年06月12日

#12 楼 @wakaka2016
提示是啥?能贴出来么?

#13 楼 @hyddd
log 如下
responseHandler.js:63:12 [master] pid:26795 Send Error Respone to Client: Error: Simulator EDFD3726-0F1E-4F6B-A64E-D00D1CD5CEA6 is not booted.

是 6s plush 的 udid
{"name":"iPhone 6s Plus","udid":"EDFD3726-0F1E-4F6B-A64E-D00D1CD5CEA6"

匿名 #13 · 2016年06月17日

#14 楼 @wakaka2016 杂事比较多,才看到回复。光看上面的信息我没法给出靠谱建议。但可以确定的是 webdriver-server 的 responseHandler.js 出了问题,try-block 有 30 行代码,我建议你 debug 下这 30 行代码看具体抛异常是在哪个位置以及当时的上下文如何。

#14 楼 @wakaka2016

你的 xcode 版本是多少?
我也碰到过这个问题,由于 xcode 不是最新的所以模拟器只能到 ios9.2,而测试脚本里是 9.3,改成 9.2 就能起来了。
试试看吧

匿名 #31 · 2016年06月28日

@wakaka2016 前 2 天讲座,有个朋友遇到和你类似的情况了。1,确定是不是楼上的问题;2. 用 chown 把/usr/local/lib/node_modules 目录改为当前用户,EDFD3726-0F1E-4F6B-A64E-D00D1CD5CEA6 not boot,实际上应该是启动了模拟器的,但是 root 账户和当前用户账户的同款模拟器 uuid 不同,如果以 root 运行了 macaca run,接下来 server 启动还是当前用户,可能造成以上问题。你可以手工看看模拟器 uuid 是否匹配:xcrun simctl list devices

@wakaka2016 @hyddd sudo chown -R $USER /usr/local,不要 sudo 运行

请问启动虚拟机是根据什么启动的,js 里面指定的是 iphone 5s 可是启动了 6s plus 然后就导致机器找不到执行失败了

#19 楼 @websky xcrun simcli list 看下你的设备名

#20 楼 @xdf xcrun: error: unable to find utility "simcli", not a developer tool or in PATH 出现这个

@websky xcrun simctl list

#22 楼 @xdf admins-Mac-mini:~ admin$ xcrun simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6s (com.apple.CoreSimulator.SimDeviceType.iPhone-6s)
iPhone 6s Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6s-Plus)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
iPad Air (com.apple.CoreSimulator.SimDeviceType.iPad-Air)
iPad Air 2 (com.apple.CoreSimulator.SimDeviceType.iPad-Air-2)
iPad Pro (com.apple.CoreSimulator.SimDeviceType.iPad-Pro)
Apple TV 1080p (com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p)
Apple Watch - 38mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm)
Apple Watch - 42mm (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-42mm)
== Runtimes ==
iOS 9.2 (9.2 - 13C75) (com.apple.CoreSimulator.SimRuntime.iOS-9-2)
tvOS 9.1 (9.1 - 13U78) (com.apple.CoreSimulator.SimRuntime.tvOS-9-1)
watchOS 2.1 (2.1 - 13S660) (com.apple.CoreSimulator.SimRuntime.watchOS-2-1)
== Devices ==
-- iOS 9.2 --
iPhone 4s (11FD0778-6F2F-405D-B7AA-7C47CCA4036E) (Shutdown)
iPhone 5 (D9A5ABAB-D269-4114-8EA6-183216571B82) (Shutdown)
iPhone 5s (10EA95BA-21FC-4520-AD62-56D8358E7D65) (Shutdown)
iPhone 6 (2D94D456-0622-4EBB-BFE0-BEE13ACB2883) (Shutdown)
iPhone 6 Plus (1609CC28-EBD3-4BA1-BF70-F2943AA7F6B8) (Shutdown)
iPhone 6s (8CB8BED4-56BE-43FC-B56A-26FFF0466C74) (Shutdown)
iPhone 6s Plus (CE9874BD-2F3D-47EC-A12A-8421C56F035E) (Shutdown)
iPad 2 (20B4F2D8-0658-4AA0-BAF5-7DB668000F09) (Shutdown)
iPad Retina (5B3B4EA5-30E9-4B1F-82CD-E444563C299E) (Shutdown)
iPad Air (9FB6B865-8FF4-4072-9412-B1B50CD73159) (Shutdown)
iPad Air 2 (F57DF6DA-3C40-4E10-9F05-3642DAD65DA4) (Shutdown)
iPad Pro (601AC817-D967-42A0-B4CB-E28DEE4C7B6B) (Shutdown)
-- tvOS 9.1 --
Apple TV 1080p (E6B7E749-E9B2-40BD-BBC4-860E42459BA1) (Shutdown)
-- watchOS 2.1 --
Apple Watch - 38mm (46E212D0-1C8B-44B3-AF52-8B97A32985F0) (Shutdown)
Apple Watch - 42mm (34A0F051-77B6-4FC7-986A-9A9685ABC81F) (Shutdown)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-3 --
iPhone 4s (D37A5A81-D9AB-419B-A6ED-784C3F7AE178) (Shutdown) (unavailable, runtime profile not found)
iPhone 5 (411C34D6-F9DE-46E8-8D1C-2BB6B5F1C111) (Shutdown) (unavailable, runtime profile not found)
iPhone 5s (98066712-5520-4DC9-BBDB-E1AB7DB14DA7) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 (A838500D-1D53-4E75-8070-D664151C895D) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 Plus (C89292B5-955A-47CA-A6A3-56E9992AD5F5) (Shutdown) (unavailable, runtime profile not found)
iPad 2 (F7A44910-84CB-4DD1-B237-A6CDF9F01717) (Shutdown) (unavailable, runtime profile not found)
iPad Retina (6F205B6D-AC72-490C-8F04-9B0ACAEE4481) (Shutdown) (unavailable, runtime profile not found)
iPad Air (55AE56FD-EBAA-41C2-8178-D9BBD121359F) (Shutdown) (unavailable, runtime profile not found)
Resizable iPad (B410B7DF-F787-4764-B0A6-113C33C6EEB8) (Shutdown) (unavailable, runtime profile not found)
Resizable iPhone (9AA15DA9-0080-4017-90C8-5984534FF8E5) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-9-0 --
iPhone 4s (F01076BD-6BBD-40B4-B827-92D0543DAA42) (Shutdown) (unavailable, runtime profile not found)
iPhone 5 (065DA0FD-48C3-47A4-A71C-E142BE18A306) (Shutdown) (unavailable, runtime profile not found)
iPhone 5s (5F0D8E9A-DEC9-41AF-9D34-4CDD3ED5B609) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 (1A1B42FF-7E51-41F0-A34C-F87777D1C314) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 Plus (5CF76026-516C-47E0-89AD-7D2637CE9BF0) (Shutdown) (unavailable, runtime profile not found)
iPhone 6s (61C5BE95-7B74-48F7-BB3B-110498FFC1AF) (Shutdown) (unavailable, runtime profile not found)
iPhone 6s Plus (042E48CA-010B-4081-A85C-D26BF63A4352) (Shutdown) (unavailable, runtime profile not found)
iPad 2 (22F242C3-A1EF-4B9E-BE2A-C1F8F97AD107) (Shutdown) (unavailable, runtime profile not found)
iPad Retina (553049C8-93A7-4F6A-97A3-9639C2DC1769) (Shutdown) (unavailable, runtime profile not found)
iPad Air (95ED97FE-C973-4DF5-9957-772D7D04FF3E) (Shutdown) (unavailable, runtime profile not found)
iPad Air 2 (6C3E49E4-56C4-415F-B35E-28F12D4D6E2D) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-9-1 --
iPhone 4s (CF74A2AD-707E-44B6-9FB8-3D94D06BA6B3) (Shutdown) (unavailable, runtime profile not found)
iPhone 5 (0A344464-856D-4862-A13A-DBE26991A845) (Shutdown) (unavailable, runtime profile not found)
iPhone 5s (C8E6D565-581D-45F5-8266-1FC7DA07363F) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 (F48F1650-25E0-44C2-B926-826BB719014E) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 Plus (01743F71-9508-481F-B051-AD24630C119B) (Shutdown) (unavailable, runtime profile not found)
iPhone 6s (87D2C28C-A610-4FCF-AD51-71C2D3157FA0) (Shutdown) (unavailable, runtime profile not found)
iPhone 6s Plus (94F61292-39CE-4710-92BB-9F6BEF1BABD2) (Shutdown) (unavailable, runtime profile not found)
iPad 2 (2B0B3103-5B5D-47B8-BCAF-7A4169932305) (Shutdown) (unavailable, runtime profile not found)
iPad Retina (0A99E4F0-7CE6-43FA-BF45-AC6699F793A4) (Shutdown) (unavailable, runtime profile not found)
iPad Air (6D36EC72-EABD-40A5-A30B-9A4852512AEE) (Shutdown) (unavailable, runtime profile not found)
iPad Air 2 (4F0789BA-8A80-4AE1-AF0C-968CEE833993) (Shutdown) (unavailable, runtime profile not found)
iPad Pro (259AA76B-D907-4744-892A-A6EB8FA39054) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-9-3 --
iPhone 4s (531C620B-7783-4760-AA2E-90C800F81A00) (Shutdown) (unavailable, runtime profile not found)
iPhone 5 (8A8927BA-18B0-477B-A582-E31E4EB5A7AF) (Shutdown) (unavailable, runtime profile not found)
iPhone 5s (AABFF67B-4C0D-4416-8625-4A8BF5F2118D) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 (A5331F30-FBAA-4EF7-A629-57335C61BB17) (Shutdown) (unavailable, runtime profile not found)
iPhone 6 Plus (F69899B9-E6F8-4DFD-9D77-8C6EF02D8377) (Shutdown) (unavailable, runtime profile not found)
iPhone 6s (E872B951-2855-458A-BDD8-04611AE8A110) (Shutdown) (unavailable, runtime profile not found)
iPhone 6s Plus (42C08FBD-977A-4A3C-96CD-50D1A184DEC3) (Shutdown) (unavailable, runtime profile not found)
iPad 2 (BE618302-114A-4519-B7E5-DC44DD4596B8) (Shutdown) (unavailable, runtime profile not found)
iPad Retina (BAE27C37-3E6F-4513-A0E0-7519C1095F4E) (Shutdown) (unavailable, runtime profile not found)
iPad Air (3C0716B1-ED48-4325-A9D8-C5AFE2EA308D) (Shutdown) (unavailable, runtime profile not found)
iPad Air 2 (DBF3B896-F169-4144-8CBC-E7828207B652) (Shutdown) (unavailable, runtime profile not found)
iPad Pro (501FA9DA-91CC-4DC1-ACD8-E28D381595A0) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.tvOS-9-0 --
Apple TV 1080p (85830BCE-C130-4AC5-BAF9-D2BCD0DD2224) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.tvOS-9-2 --
Apple TV 1080p (D429C6AF-8B9C-431C-A9E5-0DA6909CB1E9) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.watchOS-2-0 --
Apple Watch - 38mm (06169FD4-9C7A-4E2A-B3C0-ECFFF6218EC9) (Shutdown) (unavailable, runtime profile not found)
Apple Watch - 38mm (F607891E-89EA-4F3D-83C6-02120B0AEFCA) (Shutdown) (unavailable, runtime profile not found)
Apple Watch - 42mm (691C8097-74B5-4134-B8CE-A64E6608D6CB) (Shutdown) (unavailable, runtime profile not found)
Apple Watch - 42mm (00086676-267A-43A4-A308-CB099E2B82A3) (Shutdown) (unavailable, runtime profile not found)
-- Unavailable: com.apple.CoreSimulator.SimRuntime.watchOS-2-2 --
Apple Watch - 38mm (6B20FE06-9AF5-4F2B-8585-4E956C6DDFF6) (Shutdown) (unavailable, runtime profile not found)
Apple Watch - 42mm (501B6903-EF47-4270-A723-8058245C749E) (Shutdown) (unavailable, runtime profile not found)
== Device Pairs ==
65A325FF-7746-44D9-80C0-2B2CF82942F0 (disconnected)
Watch: Apple Watch - 38mm (46E212D0-1C8B-44B3-AF52-8B97A32985F0) (Shutdown)
Phone: iPhone 6s (8CB8BED4-56BE-43FC-B56A-26FFF0466C74) (Shutdown)
C856FD4B-D9C5-4CB4-8A7B-FE65B4158530 (disconnected)
Watch: Apple Watch - 42mm (34A0F051-77B6-4FC7-986A-9A9685ABC81F) (Shutdown)
Phone: iPhone 6s Plus (CE9874BD-2F3D-47EC-A12A-8421C56F035E) (Shutdown)
F50F1E0E-6144-46C2-A177-92A39F9324D7 (unavailable)
Watch: Apple Watch - 38mm (F607891E-89EA-4F3D-83C6-02120B0AEFCA) (Shutdown)
Phone: iPhone 6 (1A1B42FF-7E51-41F0-A34C-F87777D1C314) (Shutdown)
9D8A0808-22F8-47F8-A7A7-A7E41C46D149 (unavailable)
Watch: Apple Watch - 38mm (06169FD4-9C7A-4E2A-B3C0-ECFFF6218EC9) (Shutdown)
Phone: iPhone 6s (87D2C28C-A610-4FCF-AD51-71C2D3157FA0) (Shutdown)
1A25970C-74E7-4A04-AD4E-D902C25C8800 (unavailable)
Watch: Apple Watch - 42mm (00086676-267A-43A4-A308-CB099E2B82A3) (Shutdown)
Phone: iPhone 6 Plus (5CF76026-516C-47E0-89AD-7D2637CE9BF0) (Shutdown)
8EC529F3-69C0-4FF6-B8A5-D29E2C8E767C (unavailable)
Watch: Apple Watch - 42mm (691C8097-74B5-4134-B8CE-A64E6608D6CB) (Shutdown)
Phone: iPhone 6s Plus (94F61292-39CE-4710-92BB-9F6BEF1BABD2) (Shutdown)
2EF9AAEC-3268-461C-B4C0-53DB0B93B672 (unavailable)
Watch: Apple Watch - 38mm (6B20FE06-9AF5-4F2B-8585-4E956C6DDFF6) (Shutdown)
Phone: iPhone 6s (E872B951-2855-458A-BDD8-04611AE8A110) (Shutdown)
4675D355-4670-477E-8C08-ACF1A86534D2 (unavailable)
Watch: Apple Watch - 42mm (501B6903-EF47-4270-A723-8058245C749E) (Shutdown)
Phone: iPhone 6s Plus (42C08FBD-977A-4A3C-96CD-50D1A184DEC3) (Shutdown)

多余的 simulator 删除吧,升级到 9.3

#24 楼 @xdf 是不是我装了两个 Xcode 的原因,我有两个版本

非常感谢前面的问题已经解决了,我还想问 macaca 是驱动 instruments 做的测试吗,那是否可以得到所生成的.trace 文件,因为我想要解析他做性能测试

@websky 哥们儿,你问题解决了么?怎么解决的?升级最新版的 xcode 吗?

42楼 已删除

@xdf 能帮我看看我的错误吗,当我运行 macaca run --verbose 的时候,命令行显示这个错误,会打开对应的 iphone 5s 模拟器,但是之后就会一直停留在这个界面,然后模拟器会不停重启,不知道为什么,能帮我看看么?谢谢!

xctest-client.js:43:14 [master] pid:13337 project path: /usr/local/lib/node_modules/macaca-ios/node_modules/xctest-client/node_modules/webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
macaca-ios.js:130:10 [master] pid:13337 {
"bundleId": "xudafeng.ios-app-bootstrap",
"platformName": "iOS",
"platformVersion": "9.1",
"app": "/var/folders/wt/087zxxr171j42htkv78nd26w0000gn/T/ios-app-bootstrap.app/"
}
xctest-client.js:182:12 [master] pid:13337 xcode version: 7.1.1
xctest-client.js:155:14 [master] pid:13337 xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:71037001-E658-4C95-A6F7-010F72257F89 }

xctest-client.js:163:14 [master] pid:13337 xctest client exit with code: 70, signal: null

不是说他们都是走 wda 的?那应该就不是驱动于 instrument 了吧?

16楼 已删除

@xdf macaca-test/macaca-mobile-sample.test.js 里 ios 的系统配置信息和 macaca-mobile-browser-sample.test.js 里配置的一样。macaca-mobile-browser-sample.test.js 能调用浏览器,macaca-test/macaca-mobile-sample.test.js 报 Simulator **** is not booted。为啥叻?

macaca mobile sample

responseHandler.js:11:12 [master] pid:58436 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"10.0","deviceName":"iPhone 5s","browserName":"Safari"}}
session.js:47:10 [master] pid:58436 Creating session, sessionId: 16db1408-c417-481a-b55f-79e839a9d7c0.
ipc.js:26:36 [master] pid:58436 electron child process exited with: success!
macaca-ios.js:189:10 [master] pid:58436 Get available devices [{"name":"iPhone 5","udid":"0E4D257D-DB8E-4942-8EAC-985D9146E3E4","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 5s","udid":"332AC74E-ED98-4E6F-B603-5A9C39C804C2","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6","udid":"E68F7FCC-175C-42CA-A59F-45D3C160A9B1","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6 Plus","udid":"119F1C9D-43E2-4222-A261-CAC041AE2889","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6s","udid":"94A9F3FC-BD7B-40ED-AC93-84415E3FE406","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6s Plus","udid":"E835B5EE-E193-4DB8-95C7-1A1EAA389AE8","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 7","udid":"8D1D18B3-B6D2-4A2A-9FFB-50FA24EAF4E0","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 7 Plus","udid":"01E92D61-B5F5-4985-BEC6-5B2C4498E306","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPhone SE","udid":"41F0E4A9-7C14-457E-B718-6468BADB8E5D","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPad Retina","udid":"DD3BCE48-EF86-40BA-A113-8D5487637F08","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPad Air","udid":"F35990A0-07EF-4772-90F3-8352089007AD","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"iPad Air 2","udid":"ECFAE099-504E-4C39-804C-F2466D0960DB","state":"Creating","available":true,"runtime":"iOS 10.0"},{"name":"Apple TV 1080p","udid":"4799E6C6-196B-43D9-8EA5-3E07D8B24C74","state":"Shutdown","available":true,"runtime":"tvOS 10.0"},{"name":"Apple Watch - 38mm","udid":"4EBC578E-24D1-4222-9230-ADA95BA2691B","state":"Shutdown","available":true,"runtime":"watchOS 3.0"},{"name":"Apple Watch - 42mm","udid":"81D8D928-C9AB-44F1-AA6F-5E96B7834860","state":"Shutdown","available":true,"runtime":"watchOS 3.0"},{"name":"Apple Watch Series 2 - 38mm","udid":"57464091-5E78-4344-8641-13594FAB30D4","state":"Shutdown","available":true,"runtime":"watchOS 3.0"},{"name":"Apple Watch Series 2 - 42mm","udid":"86A35CFC-4B67-44CD-9FA7-906B87684737","state":"Shutdown","available":true,"runtime":"watchOS 3.0"}]
macaca-ios.js:234:12 [master] pid:58436 Shutdown simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 failed Error: Command failed: xcrun simctl shutdown "332AC74E-ED98-4E6F-B603-5A9C39C804C2"
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=163):
Unable to shutdown device in current state: Shutdown

responseHandler.js:54:12 [master] pid:58436 Send Error Respone to Client: Error: Simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 is not booted.
responseHandler.js:60:14 [master] pid:58436 Error: Simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 is not booted.
at sim.isBooted.then.isBooted (/Users/liyongkai/.nvm/versions/node/v6.6.0/lib/node_modules/macaca-ios/lib/macaca-ios.js:251:20)
at process._tickCallback (internal/process/next_tick.js:103:7)

Error: Simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 is not booted.
at sim.isBooted.then.isBooted (/Users/liyongkai/.nvm/versions/node/v6.6.0/lib/node_modules/macaca-ios/lib/macaca-ios.js:251:20)
at process._tickCallback (internal/process/next_tick.js:103:7)

1) "before all" hook

responseHandler.js:11:12 [master] pid:58436 Recieve HTTP Request from Client: method: DELETE url: /wd/hub/session, jsonBody: {}
responseHandler.js:23:14 [master] pid:58436 Send HTTP Respone to Client: 405 Method Not Allowed

2) "after all" hook

macaca mobile sample

responseHandler.js:11:12 [master] pid:58436 Recieve HTTP Request from Client: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"9.3","deviceName":"iPhone 5s","app":"/Users/liyongkai/Workspace/github.com/macacajs/macaca-test-sample/app/ios-app-bootstrap.zip"}}
session.js:47:10 [master] pid:58436 Creating session, sessionId: 9adb388d-2d0d-49fa-9d91-b590b29bc30a.
helper.js:196:12 [master] pid:58436 Unzipping local app form /Users/liyongkai/Workspace/github.com/macacajs/macaca-test-sample/app/ios-app-bootstrap.zip
CFBundleIdentifier is xudafeng.ios-app-bootstrap
Get bundleId xudafeng.ios-app-bootstrap from plist /tmp/ios-app-bootstrap.app/Info.plist
macaca-ios.js:189:10 [master] pid:58436 Get available devices [{"name":"iPhone 5","udid":"0E4D257D-DB8E-4942-8EAC-985D9146E3E4","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 5s","udid":"332AC74E-ED98-4E6F-B603-5A9C39C804C2","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6","udid":"E68F7FCC-175C-42CA-A59F-45D3C160A9B1","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6 Plus","udid":"119F1C9D-43E2-4222-A261-CAC041AE2889","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6s","udid":"94A9F3FC-BD7B-40ED-AC93-84415E3FE406","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 6s Plus","udid":"E835B5EE-E193-4DB8-95C7-1A1EAA389AE8","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 7","udid":"8D1D18B3-B6D2-4A2A-9FFB-50FA24EAF4E0","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone 7 Plus","udid":"01E92D61-B5F5-4985-BEC6-5B2C4498E306","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPhone SE","udid":"41F0E4A9-7C14-457E-B718-6468BADB8E5D","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPad Retina","udid":"DD3BCE48-EF86-40BA-A113-8D5487637F08","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPad Air","udid":"F35990A0-07EF-4772-90F3-8352089007AD","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"iPad Air 2","udid":"ECFAE099-504E-4C39-804C-F2466D0960DB","state":"Shutdown","available":true,"runtime":"iOS 10.0"},{"name":"Apple TV 1080p","udid":"4799E6C6-196B-43D9-8EA5-3E07D8B24C74","state":"Shutdown","available":true,"runtime":"tvOS 10.0"},{"name":"Apple Watch - 38mm","udid":"4EBC578E-24D1-4222-9230-ADA95BA2691B","state":"Shutdown","available":true,"runtime":"watchOS 3.0"},{"name":"Apple Watch - 42mm","udid":"81D8D928-C9AB-44F1-AA6F-5E96B7834860","state":"Shutdown","available":true,"runtime":"watchOS 3.0"},{"name":"Apple Watch Series 2 - 38mm","udid":"57464091-5E78-4344-8641-13594FAB30D4","state":"Shutdown","available":true,"runtime":"watchOS 3.0"},{"name":"Apple Watch Series 2 - 42mm","udid":"86A35CFC-4B67-44CD-9FA7-906B87684737","state":"Shutdown","available":true,"runtime":"watchOS 3.0"}]
macaca-ios.js:234:12 [master] pid:58436 Shutdown simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 failed Error: Command failed: xcrun simctl shutdown "332AC74E-ED98-4E6F-B603-5A9C39C804C2"
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=163):
Unable to shutdown device in current state: Shutdown

responseHandler.js:54:12 [master] pid:58436 Send Error Respone to Client: Error: Simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 is not booted.
responseHandler.js:60:14 [master] pid:58436 Error: Simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 is not booted.
at sim.isBooted.then.isBooted (/Users/liyongkai/.nvm/versions/node/v6.6.0/lib/node_modules/macaca-ios/lib/macaca-ios.js:251:20)
at process._tickCallback (internal/process/next_tick.js:103:7)

Error: Simulator 332AC74E-ED98-4E6F-B603-5A9C39C804C2 is not booted.
at sim.isBooted.then.isBooted (/Users/liyongkai/.nvm/versions/node/v6.6.0/lib/node_modules/macaca-ios/lib/macaca-ios.js:251:20)
at process._tickCallback (internal/process/next_tick.js:103:7)

3) "before all" hook

responseHandler.js:11:12 [master] pid:58436 Recieve HTTP Request from Client: method: DELETE url: /wd/hub/session, jsonBody: {}
responseHandler.js:23:14 [master] pid:58436 Send HTTP Respone to Client: 405 Method Not Allowed
4) "after all" hook

4 passing (2m)
4 failing

1) macaca mobile sample "before all" hook:
Error: [init({"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"10.0","deviceName":"iPhone 5s","browserName":"Safari"})] The environment you requested was unavailable.
at node_modules/macaca-wd/wd/lib/webdriver.js:134:15
at Request._callback (node_modules/macaca-wd/wd/lib/http-utils.js:87:7)
at Request.self.callback (node_modules/macaca-wd/node_modules/request/request.js:368:22)
at Request. (node_modules/macaca-wd/node_modules/request/request.js:1219:14)
at IncomingMessage. (node_modules/macaca-wd/node_modules/request/request.js:1167:12)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

2) macaca mobile sample "after all" hook:
Error: [quit()] Unexpected data in simpleCallback.
at exports.newError (node_modules/macaca-wd/wd/lib/utils.js:139:13)
at . (node_modules/macaca-wd/wd/lib/callbacks.js:42:12)
at cb (node_modules/macaca-wd/wd/lib/webdriver.js:165:22)
at node_modules/macaca-wd/wd/lib/webdriver.js:179:5
at Request._callback (node_modules/macaca-wd/wd/lib/http-utils.js:87:7)
at Request.self.callback (node_modules/macaca-wd/node_modules/request/request.js:368:22)
at Request. (node_modules/macaca-wd/node_modules/request/request.js:1219:14)
at IncomingMessage. (node_modules/macaca-wd/node_modules/request/request.js:1167:12)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

3) macaca mobile sample "before all" hook:
[init({"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"9.3","deviceName":"iPhone 5s","app":"/Users/liyongkai/Workspace/github.com/macacajs/macaca-test-sample/app/ios-app-bootstrap.zip"})] The environment you requested was unavailable.
Error: [init({"autoAcceptAlerts":true,"platformName":"iOS","platformVersion":"9.3","deviceName":"iPhone 5s","app":"app/ios-app-bootstrap.zip"})] The environment you requested was unavailable.
at node_modules/macaca-wd/wd/lib/webdriver.js:134:15
at Request._callback (node_modules/macaca-wd/wd/lib/http-utils.js:87:7)
at Request.self.callback (node_modules/macaca-wd/node_modules/request/request.js:368:22)
at Request. (node_modules/macaca-wd/node_modules/request/request.js:1219:14)
at IncomingMessage. (node_modules/macaca-wd/node_modules/request/request.js:1167:12)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

4) macaca mobile sample "after all" hook:
Error: [quit()] Unexpected data in simpleCallback.
at exports.newError (node_modules/macaca-wd/wd/lib/utils.js:139:13)
at . (node_modules/macaca-wd/wd/lib/callbacks.js:42:12)
at cb (node_modules/macaca-wd/wd/lib/webdriver.js:165:22)
at node_modules/macaca-wd/wd/lib/webdriver.js:179:5
at Request._callback (node_modules/macaca-wd/wd/lib/http-utils.js:87:7)
at Request.self.callback (node_modules/macaca-wd/node_modules/request/request.js:368:22)
at Request. (node_modules/macaca-wd/node_modules/request/request.js:1219:14)
at IncomingMessage. (node_modules/macaca-wd/node_modules/request/request.js:1167:12)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

Test completed!

大家有遇到这个问题吗?求助。

44楼 已删除

@xdf 请问一下 sudo make-test -android 发现 JAVA_HOME IS NOT SET 怎么解决。这命令前不带 sudo 没有权限

10楼 已删除

#13 楼 @hyddd 楼主,这是一个什么情况?
怎么看起来差点什么东西了?

坚持 appium+selenium!!!!!!!!!!

你验证经过你这几步可以运行???能不能不要出来骗人,差评!

匿名 #36 · 2017年01月24日

#41 楼 @tcl 1. 无脑喷之前,你先对下自己应用版本号和本文应用的版本号是否一致,这是 6 月的文章,版本升级可能造成流程不同。2. 最后截图就是运行证明,如果不行上面 macaca 作者的回帖会先开喷,排队还没轮到你;3. 我对无脑喷智障表示懒得沟通

Joyce306 安装 appium for mac 卡住了 中提及了此贴 03月04日 11:07
Joyce306 app-inspector 真机查看元素设置 中提及了此贴 03月07日 16:49

有没有大神知道,我 macaca doctor 后显示的 Installed driver list 下什么都没有,貌似缺少 ios 版本信息?

AllocAndInit 回复

有解决吗?我也是这样的,installed driver list 下什么都没有

mantou149 回复

@mantou149 这个问题应该影响不大,这个显示的是 iOS 驱动的版本号,如果你是初次安装的话,没有很正常,等到你下次更新以后 installed driver list 应该就会有值了 我目前的环境是这样的

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册