iOS自动化环境搭建 - Go语言中文社区

iOS自动化环境搭建


背景摘要

由于XCODE8移除了UIAutomation模块,最新版的Appium主要采用XCUItest来进行UI自动化测试,所以此篇主要针对最新版Appium的环境搭建。

实验环境

操作系统: OS X 10.13.1 

appium版本: 1.7.1

ios版本: 11.0.2

Xcode版本: 9.0.1

**********************正片如下****************************

各种工具安装

  1. 安装brew
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. 安装libimobiledevice
    
    brew install libimobiledevice
  3. 安装carthage
    
    brew install carthage


  4. 安装node.js
    
     https://nodejs.org/en/download/
      下载mac下的pkg文件一键安装就行


   5.安装cnpm
      npm install -g cnpm --registry=https://registry.npm.taobao.org


       6.安装ios-deploy

     cnpm install -g ios-deploy 


       7.安装xcpretty

           gem install xcpretty

           安装xcpretty,经常安装失败,没反应,但是大家耐心等待吧,如果时间较长的话,建议大家切换个目录重新安装。

           可以更换gem源

     gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/


       8. 安装appium

            cnpm install -g appium


 *******************核心篇***************************

       9.安装appium-xcuitest-driver依赖        进入WebDriverAgent安装目录。运行bootstrap

           第一步:cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent  

           第二步:mkdir -p Resources/WebDriverAgent.bundle 

           第三步:sh ./Scripts/bootstrap.sh


         

         上面这个虽然报错,但是不影响使用,就这样即可。


    10. 用Xcode打开WebDriverAgent,并且编译(如果编译的过程中有语法错误,应该是第10步没有安装好)

           第一步:进入WebDriverAgent 文件夹,方法:打开Finder,然后选择前往文件夹输入:

          /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent 

         

           第二步:双击WebDriverAgent.xcodeproj打开此项目,编译WebDriverAgentLib:按照截图修改,然后点击编译(那个播放按钮)

            PS:编译最好是用开发者账号,可以找研发同学要

        

          第三步:编译WebDriverAgentRunner

              

 

11. 建立服务WebDriverAgent (手机和MAC都在同一个网段下,且都能连接外网)

       第一步:cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent

       第二步:xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=真机的udid' test

      udid如何查看:

     打开itunes,连接上手机,见图片所示

      

    这时候可以看到手机上多了一个WebdriverAgent的app


***************以下开始appium配置的环境搭建**********************************

12. Appium-dmg下载安装(喜欢界面操作可以再安装下)

      https://github.com/appium/appium-desktop/releases/tag/v1.2.7 [appium-desktop-1.2.7.dmg]

13. 启动Appium,点击如下“红圈“就可以使用inspector了

     

至此,就可以愉快地写你的自动化用例了。



版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/m417868/article/details/78919275
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-06-27 22:51:28
  • 阅读 ( 1435 )
  • 分类:Go环境配置

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢