Appium测试ios环境搭建

来源:互联网 发布:无线图像传输 单片机 编辑:程序博客网 时间:2024/04/30 17:35

1.环境要求:

用Appium测试ios应用必须在Mac系统下;

可测试.ipa或.app文件,用真机测试应用必须带开发者证书签名;不能用appstore下载的应用,因为下载的都是带release证书签名的应用。

2.安装:我是用.dmg包安装的,下载后双击打开,把Appium图标拖到Application即可;

3.检测环境依赖:

Appium是用node.js开发的,依赖node。检测方式:

打开Appium右上角的听诊器图标自动检测,需要安装的输入y回车自动安装

需要注意的是如果没有Android测试环境,检测程序会报错,其实不用管他,如果你是个处女座患者,看着一行红色提示很不爽,可以修改检测程序,修改方法见下一篇博客

4.编译被测应用:

xcodebuild -target  [appname]  -sdk iphonesimulator(抄自《ios测试指南》)

5.开始测试:

1)启动Appium.app,点击IOS按钮,勾选“App Path”,选择被测应用。勾选“Force Device”设置模拟器;

2)点击“launch”启动服务;

3)点击放大镜按钮启动录制程序;

4)点击“Record”,进行各种业务操作,录制程序下方会自动生成脚本;

5)将脚本复制到IDE中,修改脚本,加入延时和条件判断等,运行脚本进行测试(appium没有“回放”按钮,也不能保存录制的脚本)。

测试脚本可以用Java、PHP、nodejs、Python、ruby等语言编写



官方的ios测试说明:

IOS

  • Make sure Instruments.app is not open
  • If you’re running the simulator, make sure your actual device is notplugged in
  • Make sure the accessibility helper is turned off in your Settings app
  • Make sure the app is compiled for the version of the simulator that’s beingrun
  • Make sure the app is compiled for the simulator (or real device) asappropriate (e.g., in debug mode for the simulator), or you might getaposix spawn error.
  • If you’ve ever run Appium with sudo, you might need to sudo rm/tmp/instruments_sock and try again as not-sudo.
  • If this is the first time you’ve run Appium, make sure to authorize the useof Instruments. Usually a box will pop up that you enter your password into. If you’re running Appium from source, you can simply runsudo grunt authorizefrom the main repo to avoid getting this popup. If you’re running from npm,runsudo authorize_ios instead. You need to do this every time you installa new version of Xcode, as well.
  • If you see iOS Simulator failed to install the application. and thepaths are correct, try restarting the computer.
0 0