本文主要是介绍IOS UI自动化测试环境搭建,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Xcode
App Stroe 下载安装Xcode
安装完成之后检查版本: xcodebuild -version
Xcode Command Line Tools
命令行输入:xcode-select --install
Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ideviceinstaller
brew install libimobiledevice
brew install ios-deploy
Carthage
- 安装Carthage
- brew install carthage
- 检查carthage
- carthage version
WebDriverAgent
有2中方式启动webdriveragent
- 官方下载
- 使用appium 自带的 /Users/admin/nodejs/node_global/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj
- 命令行启动
- xcodebuild -project /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 12 Pro Max' test
- 查看ios模拟器信息xcrun simctl list | grep "Booted"
- 解锁keychain,以便可以正常的签名应用,PASSWORD="replace-with-your-password"security unlock-keychain -p $PASSWORD ~/Library/Keychains/login.keychain
- # 获取设备的UDIDUDID=$(idevice_id -l | head -n1)# 真机运行测试xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "id=$UDID" test# 模拟器运行测试xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination "platform=iOS Simulator,name=iPhone X" test
模拟器相关
查看模拟器:xcrun instruments -s
启动模拟器:xcrun instruments -w 93EAE4C0-70D4-4A9B-A04E-E21E1B53A911(udid)
真机相关
查看连接的真机: idevice_id -l
查看真机安装的app: ideviceinstaller -l
查看真机信息:ideviceinfo
Macaca (元素定位)
- 安装macaca-cli
- npm install -g macaca-cli
- 安装macaca-doctor
- npm install -g macaca-doctor
- 检查macaca环境: macaca doctor
- 安装macaca-ios:
- npm install -g macaca-ios
- 安装app-inspector
- npm install -g app-inspector
- 运行 app-inspector
- app-inspector -u {apple_uuid}
这篇关于IOS UI自动化测试环境搭建的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!