环境构筑

mac系统更新完成

ruby:系统自动安装

java环境:自动安装

java环境变量配置:

https://jingyan.baidu.com/article/908080221f3cfefd91c80fbf.html

xcode:安装完成

brew:安装完成

npm和node安装完成

切换源:设成淘宝的

npm config set registry http://registry.npm.taobao.org/

cnpm:安装完成

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

常用命令:

git:自动安装完成

libimobiledevice:安装完成,依赖:readline/sqlite/xz/python/libxml2/pag-config/libplist/libtasnl/libusb/usbmuxd/

 

 

入坑:

https://gems.ruby-china.com/

FXSyinergangdeMacBook-Air:/ fxszhaotianliang$ brew install libimobiledevice --HEAD

Updating Homebrew...

==> Auto-updated Homebrew!

Updated 1 tap (homebrew/core).

==> Updated Formulae

libuv

 

==> Cloning https://git.libimobiledevice.org/libimobiledevice.git

Cloning into '/Users/zhaotianliang/Library/Caches/Homebrew/libimobiledevice--git'...

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

Error: An exception occurred within a child process:

  DownloadError: Failed to download resource "libimobiledevice"

Failure while executing; `git clone --branch master https://git.libimobiledevice.org/libimobiledevice.git /Users/zhaotianliang/Library/Caches/Homebrew/libimobiledevice--git` exited with 128. Here's the output:

Cloning into '/Users/zhaotianliang/Library/Caches/Homebrew/libimobiledevice--git'...

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

FXSyinergangdeMacBook-Air:/ fxszhaotianliang$ brew list --version

brew Version

FXSyinergangdeMacBook-Air:/ fxszhaotianliang$ xcode-select

xcode-select: error: no command option given

Usage: xcode-select [options]

 

Print or change the path to the active developer directory. This directory

controls which tools are used for the Xcode command line tools (for example,

xcodebuild) as well as the BSD development commands (such as cc and make).

 

Options:

  -h, --help                  print this help message and exit

  -p, --print-path            print the path of the active developer directory

  -s <path>, --switch <path>  set the path for the active developer directory

  --install                   open a dialog for installation of the command line developer tools

  -v, --version               print the xcode-select version

  -r, --reset                 reset to the default command line tools path

FXSyinergangdeMacBook-Air:/ fxszhaotianliang$ xcode-select -v

xcode-select version 2354.

FXSyinergangdeMacBook-Air:/ fxszhaotianliang$ brew install libimobiledevice --HEAD

==> Cloning https://git.libimobiledevice.org/libimobiledevice.git

Cloning into '/Users/zhaotianliang/Library/Caches/Homebrew/libimobiledevice--git'...

 

安装:ios-deploy 完成

xcode定位的问题

报错信息:stderr: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

解决方案:找到新安装的xcode位置

sudo xcode-select —-switch /Applications/Xcode.app/Contents/Developer/

安装:npm install -g ios-deploy --unsafe-perm=true

常用方法:https://www.jianshu.com/p/9b9136fa1444

 

appium-doctor安装完成

npm install appium-doctor

 

Carthage安装完成

brew install Carthage

 

ideviceinstaller

安装

brew install ideviceinstaller

获取设备udid、安装app、卸载app、获取bundleid

 

执行命令npm install wd进行wd的安装。安装后使用npm wd -v检查是否安装成功。

 

An unknown server-side error occurred while processing the command. Original error: '10.3.3' does not exist in the list of simctl SDKs. Only the following Simulator SDK versions are available on your system: 12.1

 

idevice_id -l

ios-deploy -c

ios-deploy -c --no-wifi

 

ios-deploy --id c84bfbfe8a276e620c98d0930ec2d6083b5b55d8 --list_bundle_id

com.webd.WebDriverAgentRunner

 

 

 

/************************配置***************************/

platformName : ios

platformVersion : 12.1

udid : c84bfbfe8a276e620c98d0930ec2d6083b5b55d8

deviceName : iPhone 6

automationName : XCUITest

bundleId : com.apple.webapp

xcodeOrgId :

xcodeSigningId : iPhone Developer

 

 

{

  "platformName": "ios",

  "platformVersion": "12.1",

  "udid": "c84bfbfe8a276e620c98d0930ec2d6083b5b55d8",

  "deviceName": "iPhone 6",

  "bundleId": "com.apple.Music”,

  "xcodeSigningId": "iPhone Developer",

  "xcodeOrgId": "",

  "browserName": "Safari",

  "newCommandTimeout": "60"

}

/******************************************************/

/node_modules/_appium-xcuitest-driver@2.108.0@appium-xcuitest-driver/WebDriverAgent

 

{

  "platformName": "IOS",

  "platformVersion": "12.1.4",

  "udid": "f3b57faeefab54d9c01b20d43d2e7a12d59dea52",

  "deviceName": "iPhone 6",

  "bundleId": "net.humanbridge.mobile.HBMKarteApp",

  "xcodeSigningId": "iPhone Developer",

  "xcodeOrgId": "utawareru_kuon@qq.com"

}

 

utawareru_kuon@qq.com

xcodebuild output can be found in /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/carthage-xcodebuild.uVSyOR.log

 

Appium运行 WebDriverAgent 输入./Scripts/bootstrap.sh

 

https://testerhome.com/topics/7192

fxs!2018

 

 

 

 

环境搭建遇到问题:

安装相关软件出错:

npm安装appium出错,安装客户端模式

    libimobiledevice安装出错,依赖太多网络不稳定导致安装失败,反复安装即可解决,替换网络

               ios-deploy安装出错:因为更新系统后重新安装xcode,之前的xcode没有卸载完全导致完全

               报错信息:stderr: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command    line tools instance

  解决方案:找到新安装的xcode位置

sudo xcode-select —-switch /Applications/Xcode.app/Contents/Developer/

      安装:npm install -g ios-deploy --unsafe-perm=true

      常用方法:https://www.jianshu.com/p/9b9136fa1444

        WebDriverAgent安装过程:

WebDriverAgent自行安装的原因:WebDriverAgent 在 iOS 端实现了一个 WebDriver server ,借助这个 server 我们可以远程控制 iOS 设备。

你可以启动、杀死应用,点击、滚动视图,或者确定页面展示是否正确。

This makes it a perfect tool for application end-to-end testing or general purpose device automation.

(它说它是iOS上一个完美的e2e的自动化解决方案)

It works by linking XCTest.framework and calling Apple’s API to execute commands directly on a device.

(链接XCTest.framework调用苹果的API直接在设备上执行命令)

WebDriverAgent is developed and used at Facebook for end-to-end testing and is successfully adopted by Appium.

(Appium封装工作正在进行中,如果一旦封装好,那么以后就可以直接用Appium提供的binding了。)

It is currently maintained by Marek Cirkos and Mehdi Mulani。

 

WebDriverAgent如果IOS没有安装和签名时会报:[XCUITest] xcodebuild exited with code '65' and signal 'null'

WebDriverAgent介绍:

相当于一个木马程序首先会安装到手机上,安装上之后是一个无图标的app打开是一黑屏,appium的底层测试框架XCUtest依赖WebDriverAgent来在ios端执行脚本来控制ios的相关操作。

WebDriverAgent安装过程:

                1   appium会自行下载WebDriverAgent源代码,但是其中可能会出现相关问题,所以建议从官网上下载最新的ios驱动程序,重命名为WebDriverAgent,存放在相关(/node_modules/_appium-xcuitest-driver@2.108.0@appium-xcuitest-driver/WebDriverAgent)目录下.备注:Facebook 推出了一款新的iOS移动测试框架,官方文档:https://github.com/facebook/WebDriverAgent

2  进入WebDriverAgent的目录后,执行 ./Scripts/bootstrap.sh,其中会报错:

> web-driver-inspector@1.0.0 build /Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector

> webpack --progress --colors

 

Hash: 9ed7d0b85cc08341fd0f

Version: webpack 1.14.0

Time: 72ms

   [0] multi main 28 bytes {0} [built] [1 error]

    + 1 hidden modules

 

ERROR in ./js/app.js

Module parse failed: /Users/yefengjun/Downloads/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/js/app.js Unexpected token (59:4)

You may need an appropriate loader to handle this file type.

SyntaxError: Unexpected token (59:4)

问题分析和解决方案:

https://testerhome.com/topics/7192

找到原因了,webpack 的配置文件里面 exclude 了 node_modules 文件夹,你改变路径前 WebDriverAgent 刚好在 appium 的 node_modules 文件夹中,里面的文件都被忽略了,所以报错。

修改方法:

把 /Users/hengjiechen/.nvm/versions/node/v4.2.6/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/webpack.config.js

/node_modules/_appium-xcuitest-driver@2.108.0@appium-xcuitest-driver/WebDriverAgent中的

...

loaders: [

      { test: /\.js?$/, loaders: ['babel-loader'], exclude: /node_modules/ },

      { test: /\.css?$/, loader: 'style-loader!css-loader' },

    ]

...

改为

...

loaders: [

      { test: /\.js?$/, loaders: ['babel-loader'] },

      { test: /\.css?$/, loader: 'style-loader!css-loader' },

    ]

...

把 , exclude: /node_modules/ 这部分去掉即可。不过我只确定能打包成功,能不能正常运行没试过,你可以试下。

                       3  使用xcode打开WebDriverAgent进行签名,连接手机编译打包到手机端,ios会生成一个没有图标的app,打开黑屏。

签名WebDriverAgentRunter和WebDriverAgentRunterLib—如果没有反应则全部签名,即:选择Team,填写开发者账号,如果有红色感叹号则:选择Build Setting选项卡,

修改Product Bundle Identifier即可,随便修改只要是唯一的即可。

                      4  选择Product->Scheme-> WebDriverAgentRunter,  Product->Destination-> Device中的设备(如果没有选择会报:Logic Testing on iOS devices in not supported)

    5  开始运行Product->Test

a.   会报在WebDriverAgentRunterLib/Resources/WebDriverAgent.bundle找不到文件。解决:进入目录新建即可。

b. 会弹出(codesign 想要访问您的钥匙串中的密钥)对话框让你输入登录密钥串的密码

解决方案:https://blog.csdn.net/nithumahel/article/details/79870505

      输入管理员密码后点击始终允许。

C.  报错:Verify the Developer App certificate for your account is trusted on your device. Open Settings on iPhone and navigate to General -> Device Management, then select your Developer App certificate to trust it.

解决:提示报错信息如上,iphone6的点开通用->设备管理->信任测试账号,即可。(期间手机要连上网络)

https://www.jianshu.com/p/639920d8ec4e

6 运行成功手机上会出现驱动app

7 打开安装好的appium,启动一个session输入如下参数:

{

  "platformName": "IOS”,

  "platformVersion": "12.1.3”,:手机上查看

  "udid": "c84bfbfe8a276e620c98d0930ec2d6083b5b55d8”,:ios-deploy -c --no-wifi查看

  "deviceName": "iPhone 6",

  "bundleId": "com.apple.webapp”,:ios-deploy --id c84bfbfe8a276e620c98d0930ec2d6083b5b55d8 --list_bundle_id查看

  "xcodeSigningId": "iPhone Developer”,:固定值

  "xcodeOrgId": "utawareru_kuon@qq.com”:appid

}

8  ok成功。

 

问题:WebDriverAgentRunter程序报错,客户端不能启动,元素抓取不到等等。

9  反复重新编译WebDriverAgentRunter程序,每次测试必须启动两个服务:appium服务,WebDriverAgentRunter服务

客户端 -> appium后台服务(将不同类型客户端的脚本。。。。) -> WebDriverAgentRunter驱动服务(将appium脚本转换为ios可以识别的脚本) -> ios手机上app执行ios脚本服务

 

Ld /Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner normal arm64 (in target: WebDriverAgentRunner)

    cd /node_modules/_appium-xcuitest-driver@2.108.0@appium-xcuitest-driver/WebDriverAgent

    export IPHONEOS_DEPLOYMENT_TARGET=12.1

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -L/Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Products/Debug-iphoneos -F/Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Products/Debug-iphoneos -F/node_modules/_appium-xcuitest-driver@2.108.0@appium-xcuitest-driver/WebDriverAgent/Carthage/Build/iOS -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -filelist /Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/Objects-normal/arm64/WebDriverAgentRunner.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=12.1 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/Objects-normal/arm64/WebDriverAgentRunner_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -all_load -framework XCTest -framework WebDriverAgentLib -Xlinker -dependency_info -Xlinker /Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Intermediates.noindex/WebDriverAgent.build/Debug-iphoneos/WebDriverAgentRunner.build/Objects-normal/arm64/WebDriverAgentRunner_dependency_info.dat -o /Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner

 

Undefined symbols for architecture arm64:

  "_OBJC_CLASS_$_XCElementSnapshot", referenced from:

      l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBIsVisible in XCUIElement+FBIsVisible.o

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

appium环境搭建:https://www.7forz.com/2973/

 

编译WebDriverAgentRunner启动时报错,无法启动:

The bundle identifier for IntegrationApp.app couldn’t be read.

he application may be damaged or incomplete: “/Users/zhaotianliang/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmhgqfojndmhxiflajnbdhevngtq/Build/Products/Debug-iphoneos/IntegrationApp.app”.

 

解决方案:将IntegrationApp编译运行一下就?,手机联网。

 

link错误:

确保手机连接电脑。

 

点击事件触发报错:

[performTouchAction([{"action":"tap","options":{"x":392,"y":218}}])] Error response status: 13, , UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: Unhandled endpoint: /session/1B1D8C2F-65A5-4CEC-8BFC-1A2311221685/wda/touch/perform -- http://localhost:8100/ with parameters { wildcards = ( "session/1B1D8C2F-65A5-4CEC-8BFC-1A2311221685/wda/touch/perform" ); }

 

报错:

Could not launch “WebDriverAgentRunner”

Verify the Developer App certificate for your account is trusted on your device. Open Settings on FXS)楊波 の iPhone and navigate to General -> Device Management, then select your Developer App certificate to trust it.

解决方案:认证

 

 

1:如何书写脚本:

https://www.cnblogs.com/testlurunxiu/p/6013605.html

 

2:研究测试用例

 

3:如何并行测试

     A:如何脱离数据线进行wifi连接xcode

 

     B:xcode同时启动两个服务:8001,8002

       https://www.cnblogs.com/yuhanle/articles/8213675.html

 

     C:appium如何同时启动两个不同端口的服务

 

     D:客户端同时启动两个线程执行测试用例

 

4:如何将服务端(部分服务端)脱离Mac环境,转为linux环境,局域网中连接ios

 

5: 测试结果按照不同维度[截图/异常/成功失败/log]统计/分析,展示,推送

    ssm + vue

    

后台启动:

/Applications/Appium.app/Contents/Resources/app/node_modules/appium/build/lib/main.js

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值