Appium 自动化测试 IOS 真机调试安装以及遇到的问题

Appium 自动化测试 IOS 真机调试安装以及遇到的问题

IOS客户端尝试使用Appium框架进行自动化测试,该框架方便定制符合自身业务的测试用例,提高测试效率。在搭建测试环境时,发现真机调试安装中问题比较多,特整理以供其他遇到同样问题的同学参考。

先列出简单安装流程:

1.npm install -g appium

2.安装 carthage :brew install carthage

3.npm install -g ios-deploy

4.libimobiledevice:brew install libimobiledevice

5.gem install xcpretty

 

 WebDriverAgentRunner的处理:

 先使用mac打开终端

 1.  cd ~

 2.  下载WebDriverAgent 项目最新的代码:

      git clone https://github.com/facebook/WebDriverAgent

3.   执行 ./Scripts/bootstrap.sh

4.    cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver

5.    rm –rf WebDriverAgent 删除自带的WebDriverAgent

6.    ln –s ~/WebDriverAgent WebDriverAgent 将编译好的WebDriverAgent放入原来的路径下

7.    打开 WebDriverAgent 项目并按照教程修改, 运行 Product -> Test

(GitHub教程:https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md

8.   访问http://10.242.35.210(ip):8100,可以返回一个json。

 

如果返回失败,可以测试使用下面的方法:

       1)转发端口,在终端输入 iproxy 8100 8100 , 窗口不要关闭或者终止运行

       2)访问 http://localhost:8100/status 有内容显示

成功之后启动appium ,start inspector session,startSession。写入如下:

9.可以运行写好的测试脚本

遇到其他问题:

1.需要使用收费的开发者帐户编译WebDriverAgentRunner,其中的bundle identifier自定义可唯一标识就行(地址:https://developer.apple.com/account/

2.证书冲突,将BuildSettings里的code singing identity设置成iPhone Develpoer,解决

 

3.编译时发现ServerURLHere->http://10.242.35.210:0,端口号为0

Log如下:

background with task ID 1

Test Suite 'All tests' started at 2018-07-03 14:02:32.203

Test Suite 'WebDriverAgentRunner.xctest' started at 2018-07-03 14:02:32.206

Test Suite 'UITestingUITests' started at 2018-07-03 14:02:32.208

Test Case '-[UITestingUITests testRunner]' started.

    t =     0.01s Start Test at 2018-07-03 14:02:32.214

    t =     0.01s Set Up

2018-07-03 14:02:32.279721+0800 WebDriverAgentRunner-Runner[3133:267743] Built at Jul  3 2018 13:59:19

2018-07-03 14:02:32.399746+0800 WebDriverAgentRunner-Runner[3133:267743] ServerURLHere->http://10.242.35.210:0<-ServerURLHere

解决方法有两种:

1)端口参数指定,增加USE_PORT=8100

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘id=udid’ USE_PORT=8100 test

2) 如果还是无法解决,Xcode打开WebDriverAgentLib-Routing-FBWebServer.m下的端口

 

4.xcodebuild failed with code 65

command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". Make sure you follow the tutorial athttps://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.

解决方法:Desired Capabilities中加入xcodeOrgId,也就是teamid。需要填写

xcodeOrgId——-teamid,可以让开发查看,或者登录https://developer.apple.com/account,membership中的TeamID

 

到此,真机的测试环境已经跑通,有什么写的不对的地方欢迎大家指正。

如果大家对于学习Python有任何问题,学习方法,学习路线,如何学习有效率的问题,可以随时来咨询我,或者缺少系统学习资料的,我做这行年头比较久,自认为还是比较有经验的,可以帮助大家提出建设性建议,这是我的Python交流qun:785128166,有任何问题可以随时来咨询我。
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值