ios模拟器安装测试包方法

1. 使用ios-sim

ios-sim是一个可以用命令空着ios模拟器的工具。利用这个命令,我们可以启动模拟器、安装app、启动app、查询ios sdk,它可以使我们像自动化测试一样打开xcode,ios-sim只支持xcode6以后的版本。

命令使用如下:

# 安装ios-sim的命令
# 先安装node
npm install ios-sim -g

# 安装.app包到模拟器
ios-sim launch app文件目录 --devicetypeid 模拟器版本
ios-sim launch /Users/Desktop/test.app --devicetypeid iPhone-6s

#查询模拟器列表命令
xcrun simctl list

xcode模拟器的位置为:/Users/soumoemoe/Library/Developer/CoreSimulator/Devices
 
App的位置:
假如模拟器为 iPhone 6s (60B8F826-8241-498A-A180-35C3F4F59562) (Booted)
则application目录在:/Users/soumoemoe/Library/Developer/CoreSimulator/Devices/60B8F826-8241-498A-A180-35C3F4F59562/data/Containers/Data/Application

2. xcrun:Xcode允许我们使用xcrun命令运行模拟器、管理安装包

命令使用如下:

# 列出安装的所有可用模拟器
xcrun instruments -s

'''
结果:
iPhone 8 Plus (11.2) [18B8751C-097C-427C-9DB8-BF59FB3C1D7E] (Simulator)
iPhone 8 Plus (11.2) + Apple Watch Series 3 - 42mm (4.2) [E381F8A1-54E9-4428-BE4A-7011902C5D69] (Simulator)
iPhone SE (11.2) [D8ACFB1F-6678-4014-8993-72050939481D] (Simulator)
iPhone X (11.2) [1346D0CB-C0A7-40F9-BB8B-C095B736C696] (Simulator)
'''

#开启指定模拟器
xcrun instruments -w "iPhone 8(11.2)

# 安装指定的app
xcrun simctl insall booted <app路径>

# 运行指定的app(com.test.app)
xcrun simctl launch booted <app identifier>

# 卸载指定的应用
xcrun simctl uninstall booted <app identifier>

 

posted @ 2019-03-05 15:05  BelleLs  阅读(2826)  评论(0编辑  收藏  举报