霍格沃兹测试开发学社

《Python测试开发进阶训练营》(随到随学!)
2023年第2期《Python全栈开发与自动化测试班》(开班在即)
报名联系weixin/qq:2314507862

iOS自动化真机测试验证环境过程中常见问题解析

本文节选自霍格沃兹测试学院内部教材

本章节主要讲解 iOS 自动化真机配置以及在 iOS 真机执行自动化时常见问题与解决方法。

真机使用的Capability

与模拟器不同,真机测试需要如下的 Capability

方式一:设置 App 路径,启动 App(自动安装 App)


{  "app": "/Users/seveniruby/Library/Developer/Xcode/DerivedData/UICatalog-ftyzdbgapjmxxobezrnrxsshpdqh/Build/Products/Debug-iphoneos/UICatalog.app",  "automationName": "XCUITest",  "platformName": "ios",  "xcodeOrgId": "xxxxxx",  "xcodeSigningId": "iPhone Developer",  "udid": "9df22446af15919c494c85b4c1c8b00eaa3a5bd0"}

方式二:根据 App 包名启动 App


{  "platformName": "ios",  "bundleId": "com.example.apple-samplecode.UICatalog",  "automationName": "XCUITest",  "deviceName": "iPhone",  "udid": "auto",  "xcodeOrgId": "xxxxx",  "xcodeSigningId": "iPhone Developer"}
  • app: Xcode 选择真机编译后的 app 位置
  • bundleId: 每个 App 的标识,相当于 Android App 的 appPackage
  • xcodeOrgId: Team ID,获取方法详见https://ceshiren.com/t/topic/11539
  • udid:auto 会根据 deviceName 返回的参数自动获取 udid

注意:编译成功后需要在手机里信任证书

使用Appium Desktop验证环境

以上步骤完成后,出现下图表示真机环境配置成功

常见问题

**问题一 **

Failed to register bundle identifier

  • 原因:bundle identifier 有重复
  • 解决方法:修改为唯一的即可

**问题二 **

执行 instruments -s devices 命令报错:Hogwarts $ instruments -s devices xcode-
select: error: tool 'instruments' requires Xcode, but active developer
directory '/Library/Developer/CommandLineTools' is a command line tools
instance

  • 原因:安装了 Xcode,但是不在系统默认的目录下。
  • 解决方法:需要把 Xcode 的路径修改为你安装的位置,可以在终端里面用命令修改,执行命令 sudo xcode-select --switch /Applications/Xcode.app

**问题三 **

运行脚本过程中,手动停止脚本时,偶尔会报错 Showing All Messages WebDriverAgentRunner-Runner.app
(3413) encountered an error (Early unexpected exit, operation never finished
bootstrapping - no restart will be attempted. (Underlying error: The test
runner exited with code 74 before checking in.))

  • 解决方法:重启手机或者拔掉 IOS 数据线,重新连接电脑

**问题四 **


note: Using new build systemnote: Building targets in parallelnote: Planning buildnote: Constructing build descriptionerror: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "L62JHCGMQW" with a private key was found. (in target 'WebDriverAgentLib' from project 'WebDriverAgent')error: No profiles for 'com.facebook.WebDriverAgentRunner.xctrunner' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.facebook.WebDriverAgentRunner.xctrunner'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
  • 原因:更换手机后,未重新 build;
  • 解决方法:更换手机后重新 build WDA,然后点击 test 安装 wda

**问题五 **


Assertions: System: Early unexpected exit, operation never finished bootstrapping - no restart will beattempted. (Underlying Error: The test runner exited with code 74 before checking in. If you believe thiserror represents a bug, please attach the result bundle at/Users/dzkair/Library/Developer/Xcode/DerivedData/WebDriverAgent-alwvnomvwrdtzoaxbbkniqrpcdpp/Logs/Test/Test-WebDriverAgentRunner-2020.11.26_10-47-38-+0800.xcresult)
  • 解决方法:重新插拔手机即可

常见问题给大家总结了这些,如果大家有遇到其他的问题也可以在下方留言哦~

** _
来霍格沃兹测试开发学社,学习更多软件测试与测试开发的进阶技术,知识点涵盖web自动化测试 app自动化测试、接口自动化测试、测试框架、性能测试、安全测试、持续集成/持续交付/DevOps,测试左移、测试右移、精准测试、测试平台开发、测试管理等内容,课程技术涵盖bash、pytest、junit、selenium、appium、postman、requests、httprunner、jmeter、jenkins、docker、k8s、elk、sonarqube、jacoco、jvm-sandbox等相关技术,全面提升测试开发工程师的技术实力
QQ交流群:484590337
公众号 TestingStudio
点击获取更多信息

posted @   霍格沃兹测试开发学社  阅读(274)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-12-31 职场晋升“潜规则”:资深测试经理的职场忠告与经验分享
点击右上角即可分享
微信分享提示