基于 XCTestWD,swiftmonkey 二次开发,实现无需插桩的 iOS monkey 自动化工具 fastmonkey
优势
无需插桩!
高效率,每秒 4-5 个 action!
轻量极简!
原理
先致敬两个开源工具;
1.swiftmonkey
https://github.com/zalando/SwiftMonkey
因其直接使用了 苹果的私有 api 如 XCEventGenerator.tapAtTouchLocations 故执行速度极快。同时也用类似 android monkey 的事件生成机制,自身源源不断的产生如 tap,swipe,pinchIn 等事件使其对被测 app 产生了极大的压力
缺点:需要插桩
2.XCTestWD
https://github.com/macacajs/XCTestWD
类似 facebook wda 的方式,在 xcode 中执行 xcuitest 时启动一个监听 server,可通过外部发送命令来创建待测 app 对应 session 并启动 app,同时也实现了 dump tree 和依据 xpath,id 等来定位某个控件并操作这些控件
3.Fastmonkey
(https://github.com/zhangzhao4444/Fastmonkey)
结合两者优点并改造两者,在 XCTestWD 基础上实现一个 server 路由,外部命令时可引导启动 app 并执行 monkey
首先感谢来自熊猫 tv 的大佬@zhangzhao_lenovo的无私贡献,开源给我们社区使用,这基本算 UIAutomation 被遗弃后,第一款无须注入就能使用的 iOS monkey 测试的工具了,给 zhangzhao_lenovo 大佬点赞。其次感谢 macaca 团队的@SamuelZhaoY @xdf 大佬们(ps:肯定还有其他大佬,这里我只把 XCTestWD 的作者,和我们最熟悉的达峰大佬 @ 出来了,希望其他大佬不要在意),给我们做自动化测试的人员提供那么好用的 macaca,以及他们自己写的可以用来代替 WDA 的 XCTestWD,我代替伸手党们对你们表示感谢。
废话不多说了,今天我开始使用 Fastmonkey,最开始配置有点小问题,但是很快在 zhangzhao_lenovo 大佬以及@Only7的帮助下解决了,这里我来写个扫盲贴(安装贴?)
第一步:打开终端,git clone 下来(其他方式皆可)
$ git clone https://github.com/zhangzhao4444/Fastmonkey.git
第二步:因为我是直接 git 下来的,Fastmonkey 在我的/Users/xxxxx/Fastmonkey
路径下,接下来我们更新依赖包.
先定位到 XCTestWD-master 下
$ cd /Users/xxxxx/Fastmonkey/XCTestWD-master
cartfile 安装第三方库
$ carthage update
第三步:第三方库下载好,开始配置 XCTestWD.xcodeproj。我们用 Xcode 打开 XCTestWD.xcodeproj,然后来配置 XCTestWD 里面的一些内容
首先是 XCTestWD->General->Signing->Team,把账号设置好,具体可以见 XCTestWD 的配置,保证不报错。
当然 XCTestWDUITests->General->Signing->Team 也一样
然后在 XCTestWD->Build Setting->Header Search Paths 和 XCTestWD->Build Setting->Objective-C Bridging Header 中,把里面的 XCTestWD/XCTestWD-Bridging-Header.h 删掉。
理由见下面。
第四步:环境配置好了,就是运行了,我这里就直接用真机来运行的。
首先,打开一个终端窗口,执行:
$ iproxy 8001 8001
接着,再打开一个终端窗口。执行:
$ cd /Users/xiatian/Fastmonkey/XCTestWD-master/XCTestWD
$ xcodebuild -project XCTestWD.xcodeproj \
-scheme XCTestWDUITests \
-destination 'platform=iOS,name=(your device name)' \
XCTESTWD_PORT=8001 \
clean test
出现上面的页面,说明 XCTestWD 运行成功了
最后,打开第三个终端窗口,执行:
$curl -X POST -H "Content-Type:application/json" \
-d "{\"desiredCapabilities\":{\"deviceName\":\"xxxx\",\"platformName\":\"iOS\", \"bundleId\":\"com.PandaTV.Live-iPhone\",\"autoAcceptAlerts\":\"false\"}}" \
http://127.0.0.1:8001/wd/hub/monkey
你就可以看见你手机成功打开 PandaTV,然后 monkey 似的在那乱点了~~~~
问题:
一、error: bridging header '/Users/xxxxx/Fastmonkey/XCTestWD-master/XCTestWD/XCTestWD/XCTestWD-Bridging-Header.h' does not exist
原因:
xcode buildsetting 有问题。 xctestwd 中没有用到 oc,swift 混编,header search path,objecktive-c bridging header 配置可去掉再试试。xctestwduitest 中用了混编才需要 xctestwduitest-bridging-header.h
解决方案:
在XCTestWD->Build Setting->Header Search Paths 和 XCTestWD->Build Setting->Objective-C Bridging Header中,把里面的 XCTestWD/XCTestWD-Bridging-Header.h 删掉
二、Swifter 无法找到
原因:未安装第三方库
解决方案:
先定位到 XCTestWD-master 下
$ cd /Users/xxxxx/Fastmonkey/XCTestWD-master
cartfile 安装第三方库
$ carthage update
三、如果 Mac 插入多台 iPhone 设备
iproxy 8001 8001 后需要加 serialid 指定哪台 iPhone 设备做端口映射。 然后 curl 中执行对应 iPhone 设备
四、xcodebuild 方式跑起来的截图和 crash 日志在哪里找呢?
xcode 里中断运行时 有个 log 路径的日志输出 xxx/XCTestWD-xxx/Logs/Test/Attentment
五、crash log 也是会生成在 Attachments 文件夹里面吗? 该 crash log 是否可以追踪到 app 代码问题?
crash 也在 Attachments 里
就是系统生成的崩溃堆栈文件,研发有对应的符号文件是可以定位的
当然,最后再次感谢 zhangzhao_lenovo 大佬,该贴只为扫盲,解决一些小白的安装流程及问题,做了伸手党,也要帮大佬解决一点小问题嘛。
大佬原贴在此:https://testerhome.com/topics/9524
有难度的问题可以去该帖近距离触摸 zhangzhao_lenovo 大佬,没难度的就在这个帖子下面大家一起讨论吧。
照例,在最后 @ 几个大神防止帖子沉下去。。。。
@seveniruby @xdf @zhangzhao_lenovo@Lihuazhang@pliue(ps:继续抱大腿活动)
2017-10-19 更新
最近升级 Xcode9 和 iOS11 后,fastmonekey 也受到一定影响,存在一些新的问题,大家可以看下这篇文章:https://testerhome.com/topics/10390,希望能帮助你们解决问题。
感谢@Test_Sir的贡献。
学习学习
Mark ! 感谢分享!
请问下执行 iproxy 8001 8001 报错 iproxy 找不到是什么原因,还有第二个和三个终端的 deviceName 就是苹果手机的 udid 吗
Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.3' 提示我这个 我应该怎么处理
deviceName 是你的设备名称啊
xcode->device->你的设备->name
一般是 XXX 的 iPhone
执行到最后一步,提示找不到我的设备,但是错误日志里打出的列表中又有我的设备。。。
执行命令是:xcodebuild -project XCTestWD.xcodeproj -scheme XCTestWDUITests -destination 'platform=iOS,name=(“张圣洁” 的 iPhone)' XCTESTWD_PORT=8001 clean test
错误日志:
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS, name:(“张圣洁” 的 iPhone) }
The requested device could not be found because no available devices matched the request.
Available destinations for the "XCTestWDUITests" scheme:
{ platform:iOS, id:48ade89d767be26fa2d6a53eec51085e02e43ec6, name:“张圣洁” 的 iPhone }
{ platform:iOS, id:537a954539a82db33ed879a4d500c70a8458de9c, name:yan 的 iPhone }
{ platform:iOS Simulator, id:B896FC57-4760-4930-AB11-2D5C4E223769, OS:10.3.1, name:iPad (5th generation) }
{ platform:iOS Simulator, id:1662F473-A67B-4E6A-8971-651B16394D72, OS:10.3.1, name:iPad Air }
{ platform:iOS Simulator, id:6D42E5E7-0F33-4A20-9837-E0BADBBA8342, OS:10.3.1, name:iPad Air 2 }
{ platform:iOS Simulator, id:950FB86A-CDEC-40F0-8FF2-AC2800F884DF, OS:10.3.1, name:iPad Pro (9.7 inch) }
{ platform:iOS Simulator, id:0512C785-4C39-4F35-93DA-B383CC8510DE, OS:10.3.1, name:iPad Pro (10.5-inch) }
{ platform:iOS Simulator, id:CAFEDC20-E79F-4061-9E24-B55E37A353B1, OS:10.3.1, name:iPad Pro (12.9 inch) }
{ platform:iOS Simulator, id:745B0C59-04DF-43D8-B431-086F74CAD7A5, OS:10.3.1, name:iPad Pro (12.9-inch) (2nd generation) }
{ platform:iOS Simulator, id:C79D11A9-DFE7-43A9-9871-3C030360AD57, OS:10.3.1, name:iPhone 5 }
{ platform:iOS Simulator, id:85F607AE-C9C5-4230-A5F6-01361253BBBF, OS:10.3.1, name:iPhone 5s }
{ platform:iOS Simulator, id:6D792B46-0296-4332-B643-FAC2BCB485B4, OS:10.3.1, name:iPhone 6 }
{ platform:iOS Simulator, id:8F207306-E311-43A5-8826-76C526E1E54E, OS:10.3.1, name:iPhone 6 Plus }
{ platform:iOS Simulator, id:FAE72621-4D4D-40DB-B6A8-CB422F8ABBFD, OS:10.3.1, name:iPhone 6s }
{ platform:iOS Simulator, id:34B7D02E-DBFC-4BCB-94D9-013E9B34BE91, OS:10.3.1, name:iPhone 6s Plus }
{ platform:iOS Simulator, id:F5C83B6B-148B-4C5A-B6E6-E620DE0ACA60, OS:10.3.1, name:iPhone 7 }
{ platform:iOS Simulator, id:2E95E3EF-D2FB-4921-A613-27021378E2DA, OS:10.3.1, name:iPhone 7 Plus }
{ platform:iOS Simulator, id:46143C6D-A772-450C-A8E9-CA0B429650F6, OS:10.3.1, 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 }
运行 xcodebuild -project XCTestWD.xcodeproj 这句报错:
2017-08-30 19:02:35.530 xcodebuild[41499:4750078] Error Domain=IDETestOperationsObserverErrorDomain Code=4 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/mac/Library/Developer/Xcode/DerivedData/XCTestWD-cseytoewhlzxivgopaonbuqulosj/Logs/Test/BBE6C2E9-EFFC-4AC7-BF69-A360B492C709/Session-XCTestWDUITests-2017-08-30_190230-J7U8QS.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/mac/Library/Developer/Xcode/DerivedData/XCTestWD-cseytoewhlzxivgopaonbuqulosj/Logs/Test/BBE6C2E9-EFFC-4AC7-BF69-A360B492C709/Session-XCTestWDUITests-2017-08-30_190230-J7U8QS.log}
Testing failed:
Use of undeclared type 'XCTestWDMonkey'
Use of unresolved identifier 'XCTestWDMonkey'
** TEST FAILED **
The following build commands failed:
CompileSwift normal armv7 /Users/mac/Documents/Fastmonkey/XCTestWD-master/XCTestWD/XCTestWDUITests/XCTestWDRunner.swift
CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
(2 failures)
你 curl 中设备名不要打引号啊,就像下面这个:
curl -X POST -H "Content-Type:application/json" \
-d "{\"desiredCapabilities\":{\"deviceName\":\"XXX的 iPhone\",\"platformName\":\"iOS\", \"bundleId\":\"com.neudzf.CSDNBlog\",\"autoAcceptAlerts\":\"false\"}}" \
http://127.0.0.1:8001/wd/hub/monkey
其次你先不要插两台设备,如果要并发的话,请参考原贴的回复 https://testerhome.com/topics/9524
{ platform:iOS, id:48ade89d767be26fa2d6a53eec51085e02e43ec6, name:“张圣洁”的 iPhone }
{ platform:iOS, id:537a954539a82db33ed879a4d500c70a8458de9c, name:yan的 iPhone }
我用 xocode 安装的 xctestwd,然后 curl 的时候 链接的时候有问题
服务端:
Requesting connecion to device handle == 8 (serial: 48ade89d767be26fa2d6a53eec51085e02e43ec6), port 8001
Error connecting to device!
链接端:
curl: (52) Empty reply from server
首先是 xcode 不是 xocode,你这代码注意点,别因为打错导致错误。
其次,你先按我写的指导教程一步一步的走嘛,先跑通,你再去用 xcode run 嘛。。。
最后,你这个是链接失败的错误,看看是不是端口没打开或者 xctestwd 没装好?
个人建议,你先按我的指导贴一步一步走一遍,看看是不是还有问题,再来提好吗?
求教,按照你的步骤执行,在执行到 xcodebuild -project XCTestWD.xcodeproj -scheme XCTestWDUITests -destination 'platform=iOS,name=slideplus' XCTESTWD_PORT=8001 clean test 出现下图错误,帮忙看下如何处理,万分感谢🙏
你这个是代码层面的错误,建议去问@zhangzhao_lenovo;其次,我在https://testerhome.com/topics/9524#reply232xcode 版本问题,你要不先降到 8.3.3 试试?看到你好像是
希望你能成功运行。其实我也下了 9 来用过,确实兼容方面存在一定的问题,如果是研发还好,测试使用的框架有些地方不是那么友好。
请问楼上前辈下的 Xcode8.3.3 成功了吗?我也是执行到那一步报错了;错误原因如下图我看了一下 Xcode 版本是 8.3.3,请教一下大神有什么办法能解决吗?
"xcode 里中断运行时 有个 log 路径的日志输出 xxx/XCTestWD-xxx/Logs/Test/Attentment "
求问这个具体路径是?
我找了很久才找到= =!
当前用户目录下的/Library/Developer/Xcode/DerivedData/XCTestWD-xxx/Logs/Test/Attachments
xcode 9.0,iOS 11 报错信息
/Users/Xx/Downloads/Fastmonkey-master/XCTestWD-master/XCTestWD/XCTestWDUITests/server/models/XCTestWDSession.swift:80:16: Use of unresolved identifier 'XCTestWDApplication'
解决方法:https://testerhome.com/topics/10390 这个帖子的问题 2 和问题 3
# 将 XCTestWDApplication.m 和 XCTestWDApplication.m 文件拖拽到 Xcode 中的 PrivateHeaders 文件下
需要在 XCTestWDUITests-Bridging-Header.h 文件中添加
#import "XCTestWDApplication.h"
ode Signing Error: No profiles for 'XCTestWD.XCTestWDUITests' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'XCTestWD.XCTestWDUITests'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
求助,一直报这个错误
The app ID "XCTestWD.XCTestWD" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
XCode 设置里把 XCTestWD->Build Setting->Header Search Paths 和 XCTestWD->Build Setting->Objective-C Bridging Header 的值 XCTestWD/XCTestWD-Bridging-Header.h 删掉
求助,我是刚接触的菜鸟,根据教程一步步来,也出现了评论里很多人提到的问题,一一解决了,但现在 build 的时候出现了个新错误:Failed to read file or folder at /Users/mac/Desktop/daisy/Fastmonkey-master/XCTestWD-master/XCTestWD/../Carthage/Build/iOS/Swifter.framework
Command /bin/sh failed with exit code 1
不知道怎么解决,我的 carthage 已经是 29 版本,且也 update 了
另:这个问题没有解决的前提下我执行 xcodebuild 那段代码时提示找不到设备(用的 ipone x)求大神帮忙
我也出现过这个问题,文件都在还是提示这个错误,开发帮忙的解决办法是把 bridging-Header.h 这个文件中报错这句修改为下面这句(原来的注释了),我的问题解决了,希望能帮到你
请问下,你的这个问题解决了吗?我这边按照教程操作时,也出现了这个问题。
Ld /Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Products/Debug-iphoneos/XCTestWD.app/XCTestWD normal arm64
cd /Users/didi/Fastmonkey/XCTestWD-master/XCTestWD
export IPHONEOS_DEPLOYMENT_TARGET=9.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/didi/.rvm/gems/ruby-2.1.10/bin:/Users/didi/.rvm/gems/ruby-2.1.10@global/bin:/Users/didi/.rvm/rubies/ruby-2.1.10/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin:/Users/didi/Library/Android/sdk/tools:/Users/didi/Library/Android/sdk/platform-tools:/Users/didi/apache-jmeter-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/didi/.rvm/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -L/Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Products/Debug-iphoneos -F/Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Products/Debug-iphoneos -F/Users/didi/Fastmonkey/XCTestWD-master/XCTestWD/../Carthage/Build/iOS -filelist /Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Intermediates.noindex/XCTestWD.build/Debug-iphoneos/XCTestWD.build/Objects-normal/arm64/XCTestWD.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Intermediates.noindex/XCTestWD.build/Debug-iphoneos/XCTestWD.build/Objects-normal/arm64/XCTestWD_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Intermediates.noindex/XCTestWD.build/Debug-iphoneos/XCTestWD.build/Objects-normal/arm64/XCTestWD.swiftmodule -framework Swifter -Xlinker -dependency_info -Xlinker /Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Intermediates.noindex/XCTestWD.build/Debug-iphoneos/XCTestWD.build/Objects-normal/arm64/XCTestWD_dependency_info.dat -o /Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Products/Debug-iphoneos/XCTestWD.app/XCTestWD
ld: warning: directory not found for option '-F/Users/didi/Fastmonkey/XCTestWD-master/XCTestWD/../Carthage/Build/iOS'
ld: framework not found Swifter
clang: error: linker command failed with exit code 1 (use -v to see invocation)
2018-04-13 21:36:27.827 xcodebuild[87354:1368155] Error Domain=IDETestOperationsObserverErrorDomain Code=14 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/2w/tt1p_4td3yq9xlbl7c2t4jn00000gn/T/com.apple.dt.XCTest/IDETestRunSession-1ECEA01F-BB7D-45AD-9CCE-65A7921FDBCA/XCTestWDUITests-C45C2C09-797F-45C7-9E6B-D470986D8814/Session-XCTestWDUITests-2018-04-13_213626-XBYpp5.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /var/folders/2w/tt1p_4td3yq9xlbl7c2t4jn00000gn/T/com.apple.dt.XCTest/IDETestRunSession-1ECEA01F-BB7D-45AD-9CCE-65A7921FDBCA/XCTestWDUITests-C45C2C09-797F-45C7-9E6B-D470986D8814/Session-XCTestWDUITests-2018-04-13_213626-XBYpp5.log}
Testing failed:
Linker command failed with exit code 1 (use -v to see invocation)
** TEST FAILED **
The following build commands failed:
Ld /Users/didi/Library/Developer/Xcode/DerivedData/XCTestWD-ehrzcglifdezddhbggaxxxevomay/Build/Products/Debug-iphoneos/XCTestWD.app/XCTestWD normal arm64
(1 failure)
我把 serverMode 改成 true,然后在执行完 monkey 之后出现如下错误
)}, isUniversal: 0, isXcodeManaged: 0, platforms: {(
>,
>
)}, filePath: >
)}
hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
bootArgs:
connected: yes
isWirelessEnabled: no
connectionType: direct
} (11.2.6 (15D100))
MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/pm/cw2vmzgx4fgbr69h7zl9fx1w0000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/bc0dfc406daf17d162760c73af6a35fc/1fd2561c180fc6838fa7565de169960e965e9ec3/XCTestWDUITests-Runner.app
state->new_bundle: /Users/dengjian/Library/Developer/Xcode/DerivedData/XCTestWD-fnuhsnwpyzwltgcbbdpzwgexyhef/Build/Products/Debug-iphoneos/XCTestWDUITests-Runner.app
state->dst_bundle: /var/folders/pm/cw2vmzgx4fgbr69h7zl9fx1w0000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.MpJNkW/XCTestWDUITests-Runner.app_sparse.ipa/Payload//XCTestWDUITests-Runner.app, binaryDiff flag: FALSE
dst_ipa: /var/folders/pm/cw2vmzgx4fgbr69h7zl9fx1w0000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.MpJNkW/XCTestWDUITests-Runner.app_sparse.ipa
MDMDirectoryDiff_block_invoke:1473 calling writeDictToFile with: /var/folders/pm/cw2vmzgx4fgbr69h7zl9fx1w0000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.MpJNkW/XCTestWDUITests-Runner.app_sparse.ipa/ManifestCache.plist
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/pm/cw2vmzgx4fgbr69h7zl9fx1w0000gp/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.MpJNkW/XCTestWDUITests-Runner.app_sparse.ipa/ManifestCache.plist
2018-04-16 15:51:17.282802+0800 XCTestWDUITests-Runner[1989:456280] +[CATransaction synchronize] called within transaction
2018-04-16 15:51:17.499111+0800 XCTestWDUITests-Runner[1989:456280] Running tests...
2018-04-16 15:51:18.797476+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[CAMLightingControl accessibilityLabel]
2018-04-16 15:51:18.797842+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[CAMLightingControl accessibilityValue]
2018-04-16 15:51:18.797943+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[CAMLightingControl accessibilityTraits]
2018-04-16 15:51:18.798116+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[CAMLightingControl isAccessibilityElement]
2018-04-16 15:51:18.798203+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[CAMLightingControl accessibilityIncrement]
2018-04-16 15:51:18.798277+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[CAMLightingControl accessibilityDecrement]
2018-04-16 15:51:18.798354+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding +[CAMLightingControl safeCategoryBaseClass]
2018-04-16 15:51:18.798614+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[PHAsset accessibilityLabel]
2018-04-16 15:51:18.798698+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[PHAsset accessibilityValue]
2018-04-16 15:51:18.798766+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[PHAsset accessibilityTraits]
2018-04-16 15:51:18.799456+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding -[PHAsset _accessibilitySavePhotoLabel:]
2018-04-16 15:51:18.799583+0800 XCTestWDUITests-Runner[1989:456280] [AXValidations] UIAccessibility Error adding +[PHAsset safeCategoryBaseClass]
2018-04-16 15:51:18.841197+0800 XCTestWDUITests-Runner[1989:456280] Continuing to run tests in the background with task ID 1
Restarting after unexpected exit or crash in XCTextWDRunner/testRunner(); summary will include totals from previous launches.
Test Suite 'Selected tests' started at 2018-04-16 15:51:19.698
Test Suite 'XCTestWDUITests.xctest' started at 2018-04-16 15:51:19.701
Test Suite 'XCTestWDUITests.xctest' failed at 2018-04-16 15:51:19.702.
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.001) seconds
Test Suite 'Selected tests' failed at 2018-04-16 15:51:19.704.
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.006) seconds
** TEST FAILED **
我也是按照教程一步一步执行的,执行 xcodebuild -project XCTestWD.xcodeproj -scheme XCTestWDUITests -destination 'platform=iOS,name=xxxx' XCTESTWD_PORT=8001 clean test 时,报这个错误
writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/70/5c415qt51rj208bd5c9yzhb00000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/2721498488b81f02aeaee4cd772b0522/4095ab2a6884d5522e1c8761ff31914b1ace6ab0/ManifestCache.plist
2018-04-19 11:48:47.898173+0800 XCTestWDUITests-Runner[584:30646] +[CATransaction synchronize] called within transaction
2018-04-19 11:48:48.006727+0800 XCTestWDUITests-Runner[584:30646] Running tests...
2018-04-19 11:48:49.847647+0800 XCTestWDUITests-Runner[584:30646] Continuing to run tests in the background with task ID 1
Test Suite 'All tests' started at 2018-04-19 11:48:50.782
Test Suite 'XCTestWDUITests.xctest' started at 2018-04-19 11:48:50.784
Test Suite 'XCTextWDRunner' started at 2018-04-19 11:48:50.785
Test Case '-[XCTestWDUITests.XCTextWDRunner testRunner]' started.
t = 0.00s Start Test at 2018-04-19 11:48:50.787
t = 0.09s Set Up
t = 0.13s Open com.PandaTV.Live-iPhone
t = 0.18s Launch com.PandaTV.Live-iPhone
t = 0.28s Assertion Failure: XCTestWDMonkey.swift:22: Failed to launch com.PandaTV.Live-iPhone: 未能完成该操作。Application "com.PandaTV.Live-iPhone" is unknown to FrontBoard.
t = 0.33s Tear Down
Test Case '-[XCTestWDUITests.XCTextWDRunner testRunner]' failed (0.327 seconds).
Test Suite 'XCTextWDRunner' failed at 2018-04-19 11:48:51.115.
Executed 1 test, with 1 failure (0 unexpected) in 0.327 (0.330) seconds
Test Suite 'XCTestWDUITests.xctest' failed at 2018-04-19 11:48:51.116.
Executed 1 test, with 1 failure (0 unexpected) in 0.327 (0.332) seconds
Test Suite 'All tests' failed at 2018-04-19 11:48:51.118.
Executed 1 test, with 1 failure (0 unexpected) in 0.327 (0.336) seconds
** TEST FAILED **
Failed to launch com.PandaTV.Live-iPhone 工程中貌似是运行熊猫直播的 app,你把 test 文件中的 bundleid 改成自己的 bundleid 试试
不知道为什么 swifter 只有改成 1.4.0 才能从 github 下载成功
还有 github "cezheng/Fuzi" ~> 1.0.0
Requesting connecion to device handle == 30 (serial: 3850dd31d6b7c9972e3ed84563db3536d6aadfec), port 8001
Error connecting to device!
遇到了上面的错误,是按照大佬的流程走的,xcode9.3,
执行如下命令时,xcodebuild -project XCTestWD.xcodeproj \
-scheme XCTestWDUITests \
-destination 'platform=iOS,name=Na_iPhone' \
XCTESTWD_PORT=8001 \
clean test
出现:
使用 serve 模式,执行第二个命令行时报错
你好,我执行了 xcodebuild -project XCTestWD.xcodeproj \
-scheme XCTestWDUITests \
-destination 'platform=iOS,name=(your device name)' \
XCTESTWD_PORT=8001 \
clean test 这一步就开始跑 monkey 了,是怎么回事呢?我的环境是 xcode9.3,iOS11
fastmonkey 提供了新的 ios 自动化 monkey 思路,值得学习,感谢楼主分享
直接在 xcode 运行 XCTestWD 可以运行,但是执行脚本报错:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_XCElementSnapshot", referenced from:
objc-class-ref in XCTestWDAccessibility.o
l__CATEGORY_XCElementSnapshot_$_XCTestWDUITests in XCTestWDAccessibility.o
objc-class-ref in XCTestWDApplicationTree.o
objc-class-ref in XCTestWDXPath.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我执行的脚本:
xcodebuild -project XCTestWD.xcodeproj \
-scheme XCTestWDUITests \
-destination 'platform=iOS Simulator,name=iPhone XR' \
XCTESTWD_PORT=8001 \
clean test
我也遇到你同样的错误,1、Error connecting to device!,2、curl: (56) Recv failure: Connection reset by peer
尴尬的是确实跑起来了。
还有一个问题:这个 monkey 脚本算是封装好了对吧?以后直接用?
Xcode10 跑完 monkey 会自动重新 run 然后返回失败 但是 app 正常
这个是什么原因呀 有人知道嘛
Xcode 版本是 9.4,请问这个错误是什么原因呢
你好,我遇到的这个问题是什么原因?
waiting for connection
accepted connection, fd = 4
waiting for connection
Number of available devices == 1
Requesting connecion to device handle == 5 (serial: 9cf965753efe71dc8cbe0fda27e2a425adb82762), port 8001
Error connecting to device!
accepted connection, fd = 4
waiting for connection
Number of available devices == 1
Requesting connecion to device handle == 5 (serial: 9cf965753efe71dc8cbe0fda27e2a425adb82762), port 8001
Error connecting to device!
accepted connection, fd = 4
waiting for connection
Number of available devices == 1
Requesting connecion to device handle == 5 (serial: 9cf965753efe71dc8cbe0fda27e2a425adb82762), port 8001
Error connecting to device!
xcode10.1,下载依赖包的时候出错:
在线求助!!!!!
xcode9.3 下载第三方插件报错 *** Fetching AEXML
*** Fetching Fuzi
*** Fetching SwiftyJSON
*** Fetching CocoaLumberjack
*** Fetching swifter
*** Fetching Nimble
*** Checking out Nimble at "v8.0.1"
*** Checking out swifter at "1.3.3"
*** Checking out CocoaLumberjack at "3.5.2"
*** Checking out SwiftyJSON at "5.0.0"
*** Checking out Fuzi at "2.0.2"
*** Checking out AEXML at "4.4.0"
*** xcodebuild output can be found in /var/folders/tp/13rlp0c911j63gnchcbk9hch0000gn/T/carthage-xcodebuild.oqTt8k.log
*** Building scheme "AEXML macOS" in AEXML.xcodeproj
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -project /Users/wangshaoce/Fastmonkey/Fastmonkey/XCTestWD-master/Carthage/Checkouts/AEXML/AEXML.xcodeproj -scheme AEXML\ macOS -configuration Release -derivedDataPath /Users/wangshaoce/Library/Caches/org.carthage.CarthageKit/DerivedData/9.3.1_9E501/AEXML/4.4.0 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/tp/13rlp0c911j63gnchcbk9hch0000gn/T/AEXML SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/wangshaoce/Fastmonkey/Fastmonkey/XCTestWD-master/Carthage/Checkouts/AEXML)
This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/tp/13rlp0c911j63gnchcbk9hch0000gn/T/carthage-xcodebuild.oqTt8k.log
Cartfile 文件内容如下:
github "glock45/swifter" == 1.3.3
github "SwiftyJSON/SwiftyJSON"
github "lovexiaov/Fuzi"
github "tadija/AEXML"
github "CocoaLumberjack/CocoaLumberjack"
github "Quick/Nimble"
Test Case '-[XCTestWDUITests.XCTextWDRunner testRunner]' failed
请教下,这个问题解决了吗?怎么解决的那?
您好,使用 carthage update 碰到下面问题,
1.因为原来的 mac 可以执行,更换了 mac 且增加了 xcode11 版本,报错类似,按下面方法直接更改版本,成功了,但是运行起手机后崩溃了
https://www.meiwen.com.cn/subject/xwdvcqtx.html
解决:Xcode > Preferences > Locations,选择 Xcode 的版本即可
2.准备回退到 xcode10.1 版本,报如下错误时,更改 carthage 文件里相关库的版本,如下所示,我安装成功了
carthage 文件内容:
github "httpswift/swifter" == 1.4.3
github "SwiftyJSON/SwiftyJSON" == 4.0
github "cezheng/Fuzi" ~> 2.1.0
github "tadija/AEXML" == 4.2.2
github "CocoaLumberjack/CocoaLumberjack" == 3.4.2
github "Quick/Nimble"
经过如下:
a.更改默认的 xcode 版本为 10.1 后,carthage update 时报错,一直卡在 CocoaLumberjack 和 SwiftyJSON,报错一般同上
b.后来注释了 CocoaLumberjack,改了 buildsetting 里的 swift 版本,还是报错,怀疑是多版本问题,删掉了其他 xcode 版本,删掉 fastmonkey,删掉了各种缓存,重新安装,同样上述报错
c.后来百度时,https://blog.csdn.net/Flying_in_the_world/article/details/88031624,
链接里贴出了 carthage 各个三方库的 git 地址, 打开 CocoaLumberjack 的 git,里面说了最新版本和之前版本兼容性
然后,果断降低版本,SwiftyJSON 也按照链接中 carthage 的版本进行更改(注意是==,不是~>),删除所有相关文件后,重新 clone fastmonkey,carthage update --platform iOS --no-use-binaries,成功了
ps:更换 xcode 版本,一个是,一个是找到 xcodeproj、xcworkspace 文件,显示简介,选择默认打开方式,点击 全部更改
求解下,我这起第二步,但是没报错,啥提示都没,这种是什么原因?没法排查。。xcode 是 10.2.1,手机是 phone6s plus,ios12
Test Case '-[XCTestWDUITests.XCTextWDRunner testRunner]' failed 你这个问题解决了嘛??
还有人在使用这个工具吗,现在 Xcode 版本已经是 11.2 了,iOS 版本已经是 13.3 了
我真的书写了什么是从开始到放弃,毁灭吧,我累了