ios UI 自动化测试【airtest】

需要用到工具:

1、GUI 工具,Airtest; https://airtest.netease.com/index.html【下载地址】>https://airtest.doc.io.netease.com/en/【文档地址】
2、iOS 代码调试工具, Xcode
3、iOS 设备安装工具, WebDriverAgent,源码,https://github.com/appium/WebDriverAgent【github】
备注,如果不会 Xcode 编辑调试 WebDriverAgent 代码的人员,可以找相关开发,要一个 WDA.ipa 安装包即可
WDA.ipa 安装包操作流程【】

1、WebDriverAgent 安装调试

第一步 配置WebDriverAgent项目

image.png

第二步 选择 WebDriverAgentRunner 项目运行到手机上

image.png

示例图
打包 .ipa

1、配置正确的配置文件

容易遇到的错误


image.png

The error message you're encountering typically occurs when there's a mismatch between the provisioning profile being used and the app's entitlements. Specifically, the get-task-allow entitlement is related to whether an app can be debugged. Here's how you can resolve this issue:
Understanding get-task-allow
get-task-allow Entitlement: This entitlement is set to true for development builds to allow debugging. For distribution builds (Ad Hoc or App Store), it should be set to false .

搜索了一下,没有找到 get-task-allow 相关配置

解决方案,选用 Debug 模式的证书

image.png

2、导出 ipa 包

  • 执行如下命令前,需要cd到第一步中我们保存的xcode项目文件目录下
xcodebuild build-for-testing -scheme WebDriverAgentRunner -sdk iphoneos -configuration Release -derivedDataPath /tmp/derivedDataPath
image.png
  • 分步执行如下命令
cd /tmp/derivedDataPath/Build/Products/Release-iphoneos
mkdir Payload && mv *.app Payload
zip -r WDA.ipa Payload

得到 WDA.ipa/private/tmp/derivedDataPath/Build/Products/Release-iphoneos 路径下面

image.png
  • ios 17 需要做适配处理【如何不处理,打包出来的 ipa 可以正常安装,但是会直接闪退】
image.png
image.png
image.png

2、安装 Airtest 工具

下载工具进行安装 https://airtest.netease.com/index.html

可能遇到的问题可以查看相关官方文档:https://juejin.cn/post/7439785794916859904

3、Airtest 链接 iOS 设备 Airtest操作文档

image.png
  • 注意点:未知原因链接不是设备,并检查不到设备可以尝试进行如下命令在终端进行
    1:brew install libimobiledevice
    brew install libimobiledevice 报错
    报错

    根据命令进行执行 brew cleanup libimobiledevice
    根据命令进行执行 brew reinstall libimobiledevice
    报错

    根据命令进行执行 export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
    根据命令进行执行 brew reinstall libimobiledevice
    成功实力

整个流程示例图


整个流程示例图

4、简单使用 Airtest 进行 UI 流程测试

1、简单脚本操作命令、
生成脚本


生成脚本

生成脚本示例


生成脚本示例
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容