Macaca Macaca 实现 IOS Monkey 测试 (支持 macaca2.x 版本)

Baozhida · 2017年03月17日 · 最后由 木头 回复于 2018年07月02日 · 5497 次阅读
本帖已被设为精华帖!

统一回复

macaca 新版替换了 facebook 的 wda。我正常安装新版 macaca 套件之后,无需坐任何修改,这个项目还可以使用

安装新版 macaca 遇到不少问题

必须的步骤:升级 macOS 到 10.12.5 ,升级 Xcode 搭配 8.3.3,安装新版 carthage,安装 gradle

MACdeMacBook-Pro:XCTestWD MAC$ macaca doctor

  macaca-doctor version: 2.0.1


  Node.js checklist:

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

  iOS checklist:

  Xcode Command Line Tools is ready, version: 2347.
  xcodebuild version: 8.3.3
  iproxy[usbmuxd] is installed at: `/usr/local/bin/iproxy`
  ios_webkit_debug_proxy is installed at: `/usr/local/bin/ios_webkit_debug_proxy`
  carthage is installed, version: 0.23.0

  Android checklist:

  JAVA version is `1.8.0_40`
  JAVA_HOME is set to `/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home`
  ANDROID_HOME is set to `/Users/MAC/Library/Android/sdk`
  Platforms is set to `/Users/MAC/Library/Android/sdk/platforms/android-25`
  ADB tool is set to `/Users/MAC/Library/Android/sdk/platform-tools/adb`
  gradle is installed, version: 4.0

  Installed driver list:

  android: 2.0.23
  ios: 2.0.18

说明

苹果去掉了原有的测试框架改用 XCTest 之后,一直等大神放出原生的 iosmonkey。但是入侵式的方式可能开发不会接受。前几天发现一个项目是通过 macaca 实现的,尽管效率比起原生模式的 monkey 差很多,总比没有好。试用了几天,基本实现 monkey 的功能。能够模拟长时间操作 App 的场景,但是无法对 App 进行 Monkey 压力测试。

从 0 到 1 非常困难,从 1 到 2 就简单很多,项目是复制来的,修复了一些 bug,修改了一点逻辑。原版在https://github.com/hujiachun/iosMonkey

我改版的项目在https://github.com/baozhida/iosMonkey

现在客户端是使用同步的方式处理发送的事件,效率稍低

经实测:

iPhone 6plus 10.2.1,每分钟可以执行大约 40 次事件;

iPhone 7 10.2,每分钟可执行大约 60 次事件;

通过修改代码实现了异步 http 请求,发送事件的请求数量可以大幅提升,但是很多请求会阻塞,没有执行,实际效果不好,遂放弃。

更新

2017.3.17: 原版本呼起 app 的指令是当成事件,按照一定的频率执行,不管现在是否是在测试 APP 页面都会执行。现在改为守护进程的模式,只有当前页面跳出测试 APP 时候才会执行打开 APP 的指令。

2017.4.5:

1.修复 app 守护进程的 bug,由于时间问题导致的

2.增加返回 homescreen 的事件,事件概率是 2%,返回手机主页 5s 后重新打开 app

0、简介

  • 1.修改了原版的构建方式,maven bulid(其实没看懂之前构建的配置)

  • 2.解决了 idevicedebug 命令呼起 app 无效的问题

  • 3.根据 app 实际情况,修改了特殊点的处理(在有些页面,点击固定的位置才能返回,不是通用的右上角)

  • 4.如果不修改直接使用,直接使用 target 下面的 jar 包,如果实现自己的方法,需要重新编译

1、功能

  • 1.可以模拟 android monkey 执行的方式,在 IOS APP 页面点击 滑动操等作,支持 ios 9 和 ios10

  • 2.支持多台 ios 一起执行

  • 3.计划保存截图(未完成)

  • 4.计划自动收集 crash 日志(未完成)

2、准备 macaca 环境

安装 usbmuxd

$ brew install usbmuxd

安装 ios-webkit-debug-proxy

$ brew install iso-webkit-debug-proxy

安装 ios-deploy

$ npm i ios-deploy -g

安装 ideviceinstaller

$ brew install ideviceinstaller

编译 libimobiledevice

libimobiledevice 需要自己编译,证实直接安装的不能用

https://github.com/libimobiledevice/libimobiledevice

下载到本地

Before building, try setting:

LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:"${LD_LIBRARY_PATH}"
CPATH=/usr/local/opt/openssl/include:"${CPATH}"
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:"${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH CPATH PKG_CONFIG_PATH
You might want to add that to your .bash_profile.

CPATH and PKG_CONFIG_PATH are for compiling. LD_LIBRARY_PATH is for runtime. See also https://gist.github.com/samrocketman/70dff6ebb18004fc37dc5e33c259a0fc

Then to compile run:

./autogen.sh
make
sudo make install

安装 carthage

$ brew install carthage

安装 macacajs 包括,macaca-cli macaca-ios

npm install macaca-cli -g

npm install macaca-ios -g

MAC 全局安装的路径分别如下:

/usr/local/lib/node_modules/macaca-cli
/usr/local/lib/node_modules/macaca-ios

检测 macaca 环境,无报错

$ macaca doctor

3、WebDriverAgent 项目重签名

按照项目

https://github.com/baozhida/MacacaAutomation

操作项目重签名

4、帮助命令

如果需要多个 iOS 设备一起执行,需要指定 proxyport ,同时 macaca 使用不同的端口

$ java -jar iosMonkey-1.0.jar -h
-u:设备的UDID
-b:测试App的Bundle
-port:macaca服务的端口,默认3456
-proxyport:usb代理端口,默认8900

5、执行 iosMonkey

开一个窗口执行

$ macaca server --verbose

在一个新窗口执行

$ java -jar [iosMonkey.jar Path] -u [设备的 UDID] -b [测试 App 的 BundleID] -port [macaca 服务端口,可选] -proxyport[usb 代理端口,可选]

6、修改源码重新打包方法

如果需要源码实现自定义的功能,在项目目录下执行

$ mvn assembly:assembly

最后提示如下,标示打包成功,target 下生成 iosMonkey-1.0.jar,可以使用最新的包

INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.350 s
[INFO] Finished at: 2017-03-06T17:01:30+08:00
[INFO] Final Memory: 20M/324M
[INFO] ------------------------------------------------------------------------
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 83 条回复 时间 点赞
xinxi 基于 Appium 的 iOSMonkey 中提及了此贴 11月25日 20:30

感谢楼主分享,能成功运行了,但是怎么能判定 app 的 crash 问题呢?不需要解析 ips 具体内容,能简单知道执行过程中 crash 了多少次就行

按照文章的方法尝试,成功实现了 iOS monkey,感谢楼主分享

仅楼主可见
仅楼主可见

2.支持多台 ios 一起执行
我这边两部手机一起跑的时候就会有一个被中断了,试了其中一个换一个端口号结果服务直接崩溃。
请问如何多台 ios 一起执行啊
需要设置什么吗

运行的时候,xctest crash 很频繁,有人在关注哈这个问题吗

梦梦GO 回复

wda 时期,每步操作 wda 都会有记录和截图,所以会存储空间会一直增长,时间久了几十上百 G 的空间也会占满,
我写了定时脚本,自动删除
目前 XCTestWD 版本,没关注这个情况

你好,这个运行会产生一些什么日志之类的东西吗。跑的时候,发现系统占用内存一直在变大,每分钟 0.01Gb 的速度增长

85楼 已删除
84楼 已删除
84楼 已删除

统一回复,支持 macaca2.x 版本,出现错误的原因不在 iosmonkey 这个项目,原因主要是在安装 macaca 以及 XCTestWD 的配置等原因,这类问题我也没法答复,请自行搜索答案,或者 到 git 上提报问题。

小施 回复

../src/idevice.h:30:10: fatal error: 'openssl/ssl.h' file not found
你的问题解决了吗 ?

xiaoluosun IOS Monkey 扩展了几个小功能 中提及了此贴 06月20日 20:07

现在用新版的 macaca,也是报错,楼主嘛时候更新呢?

Only. 回复

并没有实现,现在忙其他的事情,不怎么有时间搞这个了

刘小哥 回复

==当前启动的 APP bundleid 是<正确的 bundle ID>,非测试 APP,重新呼起测试 APP====

这个实时的分析系统日志,不是非常的实时,有延时,应该是之前跳出 app,检测到才提示的

{"sessionId":"81255d3a-aff4-4de1-a0ae-38034883a61b","status":10,"value":{"message":"An element command failed because the referenced element is no longer attached to the DOM."}

app 可能是出现 crash 了,目前 crash 之后,macaca 服务就异常了

@utopia 请问有在进行 crash 与截图部分的实现吗?

作者好,我在跑这个测试的时候,遇到了一个调不起 app 的问题,而且对 app 的 bundle ID 有问题,明明已经是正确的 bundle ID 了,但是说不是,请看日志

The command executed successfully.
---EVENT 执行了:45 次---
sending Event : Submit->(211,565)
==当前启动的 APP bundleid 是<正确的 app bundle ID>,非测试 APP,重新呼起测试 APP====
==当前启动的 APP bundleid 是<正确的 app bundle ID>,非测试 APP,重新呼起测试 APP====
==当前启动的 APP bundleid 是<正确的 app bundle ID>,非测试 APP,重新呼起测试 APP====
==当前启动的 APP bundleid 是<(null)>,非测试 APP,重新呼起测试 APP====
200
Response content:{"sessionId":"81255d3a-aff4-4de1-a0ae-38034883a61b","status":0,"value":null}
The command executed successfully.
---EVENT 执行了:46 次---
sending Event : Content->(283,266)
==当前启动的 APP bundleid 是<正确的 bundle ID>,非测试 APP,重新呼起测试 APP====
200
Response content:{"sessionId":"81255d3a-aff4-4de1-a0ae-38034883a61b","status":10,"value":{"message":"An element command failed because the referenced element is no longer attached to the DOM."}}
An element command failed because the referenced element is no longer attached to the DOM.

Baozhida 回复

$ macaca doctor


  • version 1.2.2 is outdate *
  • run: npm i -g macaca-cli@2.0.4 * ************************************

More information: https://macacajs.github.io/changelog.html

macaca-doctor version: 1.0.28

Node.js checklist:

node env: /usr/local/bin/node
node version: v7.10.0

iOS checklist:

Xcode is installed at: /Applications/Xcode.app/Contents/Developer
Xcode Command Line Tools is ready, version: 2347.
iproxy[usbmuxd] is installed at: /usr/local/bin/iproxy
ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy

Android checklist:

JAVA version is 1.8.0_131
JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
ANDROID_HOME is not set

Installed driver list:

android: 2.0.22
ios: 2.0.15

现在用的版本都跟你的一样,macacalient 也是用 2.0.1 的,然后还真的是同样的错误,是不是我用的最新的 wda 导致的呢?

刘小哥 回复

Macaca. 1.2.2
Android 1.1.34
iOS 1.0.66
Macaca client 2.0.1
当时是这样的配置
你说一模一样的报错,你用的不是老版本,老版不可能有 xctestwd 这样的信息

Baozhida 回复

作者你好,我刚才试了下 Macaca1.2.2 版本,然后 iOSmonkey 依赖 macacaclient1.0.48.jar,还是出一样的错误呢,怎么破?

Baozhida 回复

应该是的,那这个测试方案,支持到哪个版本?我换旧版本试试。

刘小哥 回复

这是最近的 macaca 版本吧,发帖时候还是老版本,新的还没试呢

大神,请教一下,我这边服务可以启动成功,在运行之后,也收到了请求,但是后面还是出错了,搞不懂啥原因,麻烦帮看一下
服务端的日志:

index.js:18:12 [master] pid:14196 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: 'xxx',
host: 'xxx',
loaded_time: '2017-06-14 14:41:15' }
middlewares.js:17:10 [master] pid:14196 base middlewares attached
router.js:127:10 [master] pid:14196 router set
webdriver sdk launched
responseHandler.js:11:12 [master] pid:14196 Recieve HTTP Request from Client[2017-06-14 14:41:24]: method: POST url: /wd/hub/session, jsonBody: {"desiredCapabilities":{"proxyPort":8900,"reuse":3,"bundleId":"cn.xxx","platformName":"ios","udid":“xxx","autoAcceptAlerts":true},"port":3456,"host":"127.0.0.1"}
session.js:47:10 [master] pid:14196 Creating session, sessionId: 6a54886d-4ac3-43d1-bb1b-0ae8d6ed6107.
ios-deploy
macaca-ios.js:240:12 [master] pid:14196 App "xxx" is already installed.
xctest-client.js:52:14 [master] pid:14196 project path: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
macaca-ios.js:158:10 [master] pid:14196 {
"bundleId": "xxx",
"platformName": "ios"
}
macaca-ios.js:160:10 [master] pid:14196 Trying to start xctestwd server...
BundleId XCTestWD.XCTestWD does not exist.
xctestwd start with port: 8900
xctest-client.js:224:14 [master] pid:14196 xcode version: 8.3.2
XCTestWD version: 1.0.33
xctest-client.js:172:14 [master] pid:14196 xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:xxx }

Unsupported device specifier option.
The device “My Mac” does not support the following options: id
Please supply only supported device specifier options.

Available destinations for the "XCTestWDUITests" scheme:
{ platform:iOS, id:xxx, name:“hdcs” 的 iPhone }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPad Air }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPad Air 2 }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPad Pro (9.7 inch) }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPad Pro (12.9 inch) }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone 5 }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone 5s }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone 6 }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone 6 Plus }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone 6s }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone 6s Plus }
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone 7 }
{ platform:iOS Simulator, id:xx, OS:10.3, name:iPhone 7 Plus }x
{ platform:iOS Simulator, id:xxx, OS:10.3, name:iPhone SE }

Ineligible destinations for the "XCTestWDUITests" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }

xctest-client.js:173:14 [master] pid:14196 please check project: /usr/local/lib/node_modules/macaca-ios/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
xctest-client.js:255:14 [master] pid:14196 killing deviceLogProc pid: 14205
xctest-client.js:260:14 [master] pid:14196 killing runnerProc pid: 14208
xctest-client.js:266:14 [master] pid:14196 killing iproxyProc pid: 14207
xctest-client.js:183:14 [master] pid:14196 xctest client exit with code: 70, signal: null
xctest-client.js:145:16 [master] pid:14196 devicelog exit with code: null, signal: SIGKILL
xctest-client.js:247:14 [master] pid:14196 Fail to start xctest: undefined
responseHandler.js:54:12 [master] pid:14196 Send Error Respone to Client: undefined

InternalServerError: Internal Server Error
at Object.throw (/usr/local/lib/node_modules/macaca-cli/node_modules/koa/lib/context.js:91:23)
at Object.module.exports (/usr/local/lib/node_modules/macaca-cli/node_modules/webdriver-server/lib/server/responseHandler.js:57:17)
at module.exports.throw ()
at onRejected (/usr/local/lib/node_modules/macaca-cli/node_modules/co/index.js:81:24)
at process._tickCallback (internal/process/next_tick.js:109:7)

xctest-client.js:211:14 [master] pid:14196 iproxy exit with code: null, signal: SIGKILL

执行 monkey 的日志:
2017-06-14 14:42:27 Response:Internal Server Error


请在命令行输入 macaca server --verbose 启动服务


请确认参数配置,需要帮助请输入 java -jar iosMonkey.jar -h
ERROR 信息 java.lang.NullPointerException
=======启动 app 守护进程=======

日志上涉及隐私的信息我手动改掉啦,真心求助大神帮忙定位下到底什么原因,万分感谢!

深蓝 回复

WDA 不用了。打开该路径下的 XCTestWD 并修改签名。

Baozhida 回复

期待哦,小白只有等你们写好再试了~😅 😅

深蓝 回复

这是最新版的 macaca 了,我还没正式使用过😂 😂 😂

作者好,这边遇见了不能卸载的问题,是和签名有关吗

responseHandler.js:54:12 [master] pid:12428 Send Error Respone to Client: Error: 2017-06-06 11:39:46.141 ios-deploy[12444:115473] [ !! ] [ ERROR ] Could not uninstall package with bundle id XCTestWD.XCTestWD

responseHandler.js:60:14 [master] pid:12428 Error: 2017-06-06 11:39:46.141 ios-deploy[12444:115473] [ !! ] [ ERROR ] Could not uninstall package with bundle id XCTestWD.XCTestWD

at ChildProcess. (/usr/local/lib/node_modules/macaca-ios/node_modules/ios-device/lib/helper.js:46:17)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at maybeClose (internal/child_process.js:899:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Error: 2017-06-06 11:39:46.141 ios-deploy[12444:115473] [ !! ] [ ERROR ] Could not uninstall package with bundle id XCTestWD.XCTestWD

at ChildProcess. (/usr/local/lib/node_modules/macaca-ios/node_modules/ios-device/lib/helper.js:46:17)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at maybeClose (internal/child_process.js:899:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Aaron 回复

能在补充一点日志么,正常情况下,idevicedebug 会自动呼起测试 app

我遇到一个问题,测试没多久就跳出 app 了,然后就一直没有跳回到被测的 app。都是下面这种情况

melody 回复

是很奇怪啊,我也遇到了,就是发了一个事件流,恰好跳出被测 app,然后没有 response,就挂了

60楼 已删除

返回 404,要怎么处理啊?

The command executed successfully.
Response content:{"value":{"width":375,"height":667},"sessionId":"f1c775ba-37b1-4c9a-a099-1e66104ab04b","status":0}
The command executed successfully.
Response content:{"value":{"width":375,"height":667},"sessionId":"f1c775ba-37b1-4c9a-a099-1e66104ab04b","status":0}
The command executed successfully.
sending Tap Event : Tap->(212.0, 37.0)
404
Response content:Not Found
请确认参数配置,需要帮助请输入 java -jar iosMonkey.jar -h
ERROR信息com.alibaba.fastjson.JSONException: syntax error, pos 3, json : Not Found

python 没有 driver.keys() 类似得方法,所以不能使用 home 按键.
python 版基本搞定

孟德功 回复

macacaclient 的依赖删除,保存,再写一遍。。。然后就不报错了

逍遥生 回复

我最新也用 npm 安装了 ios-deploy 谢谢提醒,已更新

Baozhida 重新开启了讨论 04月12日 17:13
Baozhida 关闭了讨论 04月12日 17:13
逍遥生 回复
  1. 回归测试的几次都试过晚上跑,第二天发现执行 1、2 千次事件就失败了,有 bug,也一直在优化,git 时不时就更新,真正的 APP 的 crash 没有跑出来,我司的 iosapp 还是比较稳健的,而且 ios crash 是不容易复现的(另一套 Android monkey 每次跑出很多 crash)。倒是 wda 经常 crash,不稳定。自动解析 crash 日志的难度比较大, 还没做好。
  2. 保存日志应该不难,暂时没做
  3. 最长的一次跑了近 3 个小时,5 千次事件(iPhone 6p macaca 有时响应很慢,猜测和 app 本身和 wda 有关,wda 多次出现 crash),macaca 执行事件异常,退出了

另外,通过 homebrew 安装 ios-deploy 会报错,建议通过 npm 进行安装。

@utopia
1.使用这套测试工具,有无跑了多少小时,出现多少次 crash 的报告自动整理出来呢?
2.怎么才能让 monkey 跑出来的日志自动保存下来?
3.这套 monkey 测试的脚本,假定程序不会闪退,脚本最多能坚持持续运行多少小时?

万匹丝 回复

如何重写的?我这边有同样的问题

小施 回复

服务端口要对应

段段 回复

日志很明显,端口被占,换了一个

段段 回复

我也遇到了这个问题,请问解决了吗

homescreen 事件已经添加

12deMacBook-Pro:libimobiledevice Test002$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in common
CC debug.lo
In file included from debug.c:36:
../src/idevice.h:30:10: fatal error: 'openssl/ssl.h' file not found
#include
^
1 error generated.
make[2]: *** [debug.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

没人遇到这个问题吗?

43楼 已删除

已经解决问题了

请教下,我执行 macaca doctor 没有报错,并且服务已经起起来了,

但是执行 iosMonkey.jar 的时候报错

请问是什么问题呢

@utopia HOME 可以用 keys 实现

Baozhida 回复

重新写了个 dependency 就好了~
期待更多的 monkey event,锁屏/HOME 等😁

小施 回复

设置环境变量

万匹丝 回复

过会应该就好了,清下缓存

请教,这一段是怎么设置的?

Baozhida 回复

下载了,也写入到 pom 里面了,但工程里的 pom 还是报错,影响打包不?

万匹丝 回复

http://jcenter.bintray.com 可以手动下载

Baozhida 回复

没有,下载不到 2.0.4 版的 macaca-client

Baozhida 回复

果然,哈哈。感谢

万匹丝 回复

看看仓库里有没有 macacaclient 的 jar 包

小施 回复

是横线,不是下划线,名称已经更正,谢谢提出


报这个错,何解?

自定义功能是在工程的 java 类里面修改代码,然后目录下 mvn assembly:assembly
显示 build failure

Failed to execute goal on project iosMonkey: Could not resolve dependencies for project iosMonkey:iosMonkey:jar:1.0: Failure to find macaca.webdriver.client:macacaclient:jar:2.0.4 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

咋回事?求解

正在寻找 ios monkey 的方案

Baozhida 回复

问题已经解决,感谢。

fdeferf 回复

安装 wda 不用这个,是直接 xcodebuild 安装的,安装卸载测试 APP 用这个,这个是 macaca 依赖的,也可以提前安装好,不用 macaca 指令安装

Baozhida 回复

我刚刚测试的时候,没有编译这个,成功调起了

fdeferf 回复

都需要的,你知道代替的方案么

ideviceinstaller iOS10 不需要了把?

给力!真的能用,赞

http://www.akblog.cn/2017/02/11/macOS-Sierra%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85libimobiledevice/ 安装 make 时 报各种环境的错误 这里有详细的介绍怎么解决

MJW 回复

我也是这个问题。。。但是 WDA 单独是可以 test 到真机的,求解

没有成功安装 wda 吧,这个 id 不需要改
这个属于如何配置 wda,很多帖子说的很详细

你好,我照着配了一下,运行时候 macaca server 处报:BundleId com.apple.test.WebDriverAgentRunner-Runner does not exist.导致 monkey 无法进行
但是在重签名的时候我并没有将 Bundleld 改成 com.apple.test.WebDriverAgentRunner-Runner
想请教一下这边是我漏改了哪出造成的问题?

老马 回复

这些都是依赖的工具

说下我明确知道的吧,都是在使用过程中遇到问题或者疑问,自己查询资料得到的

有误,更新

ideviceinstaller 是单独的一个项目,不是在 libimobiledevice 工具套件里面的

libimobiledevice

在 windows 上大家可以使用 iTunes 来与 iPhone 进行通信,但是 Linux 上没有这类的官方软件,所以一些爱好者就破解了 iTunes 的通信协议,然后在 Linux 上实现了该协议,也就是 libimobiledevice

可以到官网去看详细的介绍 http://www.libimobiledevice.org/
很多 ios 助手应该是依赖这个的。

简单说是可以操作 ios 手机的命令行工具,iTunes 上实现的功能,通过命令行也可实现。

mac 上安装了之后有很多命令行工具。这是一个工具套,从名称大概能知道是做什么,不明确的直接加 -h 查看帮助,很简单。

本项目用到了 ideviceinstaller idevicesyslog idevicedebug(这个是打开 app 用的) ,后期打算结合 idevicescreenshot 和 idevicecrashreport 自动分析 crash 日志。

-rwxr-xr-x    1 root  admin      9804  3  8 12:51 idevice_id
-rwxr-xr-x    1 root  admin     43316  3  8 12:51 idevicebackup
-rwxr-xr-x    1 root  admin     57448  3  8 12:51 idevicebackup2
-rwxr-xr-x    1 root  admin     27952  3  8 12:51 idevicecrashreport
-rwxr-xr-x    1 root  admin     14552  3  8 12:51 idevicedate
-rwxr-xr-x    1 root  admin     16292  3  8 12:51 idevicedebug
-rwxr-xr-x    1 root  admin     23196  3  8 12:51 idevicedebugserverproxy
-rwxr-xr-x    1 root  admin     14976  3  8 12:51 idevicediagnostics
-rwxr-xr-x    1 root  admin      9376  3  8 12:51 ideviceenterrecovery
-rwxr-xr-x    1 root  admin     28404  3  8 12:51 ideviceimagemounter
-rwxr-xr-x    1 root  admin     22244  3  8 12:51 ideviceinfo
lrwxr-xr-x    1 MAC   admin        55  7 21  2016 ideviceinstaller -> ../Cellar/ideviceinstaller/1.1.0_2/bin/ideviceinstaller
-rwxr-xr-x    1 root  admin      9828  3  8 12:51 idevicename
-rwxr-xr-x    1 root  admin     14772  3  8 12:51 idevicenotificationproxy
-rwxr-xr-x    1 root  admin     31988  3  8 12:51 idevicepair
-rwxr-xr-x    1 root  admin     27604  3  8 12:51 ideviceprovision
-rwxr-xr-x    1 root  admin     14464  3  8 12:51 idevicescreenshot
-rwxr-xr-x    1 root  admin     14880  3  8 12:51 idevicesyslog```

包括上面的 ideviceinstaller,这个是命令行安装卸载 app 用的 ideviceinstaller 是单独安装的,原文中已经说明

devicescreenshots 截屏的,idevicesyslog 查看系统日志的,idevicecrashreport 是获取 crash 日志的。还有备份,恢复手机系统的等等。

具体的使用方式查看帮助

MACdeMacBook-Pro:iosMonkey-master MAC$ ideviceinstaller -h
Usage: ideviceinstaller OPTIONS
Manage apps on iOS devices.
  -u, --udid UDID   Target specific device by its 40-digit device UDID.
  -l, --list-apps   List apps, possible options:
       -o list_user - list user apps only (this is the default)
       -o list_system   - list system apps only
       -o list_all  - list all types of apps
       -o xml       - print full output as xml plist
  -i, --install ARCHIVE Install app from package file specified by ARCHIVE.
                        ARCHIVE can also be a .ipcc file for carrier bundles.
  -U, --uninstall APPID Uninstall app specified by APPID.
  -g, --upgrade ARCHIVE Upgrade app from package file specified by ARCHIVE.
  -L, --list-archives   List archived applications, possible options:
       -o xml       - print full output as xml plist
  -a, --archive APPID   Archive app specified by APPID, possible options:
       -o uninstall - uninstall the package after making an archive
       -o app_only  - archive application data only
       -o docs_only - archive documents (user data) only
       -o copy=PATH - copy the app archive to directory PATH when done
       -o remove    - only valid when copy=PATH is used: remove after copy
  -r, --restore APPID   Restore archived app specified by APPID
  -R, --remove-archive APPID  Remove app archive specified by APPID
  -o, --options     Pass additional options to the specified command.
  -h, --help        prints usage information
  -d, --debug       enable communication debugging

usbmuxd

是 USB 和 ios 手机通信的工具,USB 通信代替 WIFI
webdriveragent 项目中有明确说明
https://github.com/facebook/WebDriverAgent/wiki/Common-Issues
截图:

iproxy 详细介绍:

http://iphonedevwiki.net/index.php/SSH_Over_USB

macaca 使用 iproxy 的帖子:

Macaca iOS 驱动调整为 USB 通信 https://testerhome.com/topics/6314

@utopia ideviceinstaller 这个开源地址下的东西 能给解释下吗 我看 macaca 好多都是这个 github 地址下的 比如 usbmuxd。
libimobiledevice 这东西是个连接驱动吧? 以前弄 ubuntu 连接 ios 手机 好像弄过这东西 今天看了这个 github 地址才知道 。还有 能解释下 用的这些 usbmuxd ios_webkit_debug_proxy ios-deploy carthage 都主要负责在你的框架里干什么事么?

@utopia 确实不错 我也打赏

太激动了,感谢

我也给你打赏,期待更多好文

已加二维码☺ ☺ ☺

好赞,是我一直期待的东西,干货满满

不错 梳理的挺清楚 上个二维码我来打赏

赞,学习啦~

—— 来自 TesterHome 官方 安卓客户端

恒温 将本帖设为了精华贴 03月17日 23:14

已改。非原创。只是优化

赞,你这个好

@utopia 高产,我得试试,标题有些错误改下

@xdf
Macaca 又多一个应用场景

@Lihuazhang
看了你的 SwiftMonkey。感觉很强大,但是不熟悉 ios 相关语言😁

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