51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 1755|回复: 3

[Appium] Appium for Mac 环境准备篇

[复制链接]

该用户从未签到

发表于 2017-6-29 15:02:05 | 显示全部楼层 |阅读模式
之前写过一篇Appium for windows的文章,因为是09年的T400,启动Android模拟器的时候死机三次,那就公司申请台Macbook air吧,15寸的Macbook Pro实在太重了,也就Mac才能真正发挥Appium的功能,支持Android和iOS。好了,废话不多,开始。


1. 爬墙
因为后续安装过程中可能会碰到墙的问题,所以首先得解决爬墙的问题。
我的方便,公司提供代理。

  1. 2. java
  2. guowenxie-macbookair:~ guowenxie$ java -version
  3. java version "1.8.0_05"
  4. Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
  5. Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

  6. 3. git
  7. guowenxie-macbookair:~ guowenxie$ git --version
  8. git version 1.8.5.2 (Apple Git-48)

  9. 4. ruby
  10. guowenxie-macbookair:~ guowenxie$ ruby -v
  11. ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]

  12. 5. brew
  13. guowenxie-macbookair:~ guowenxie$ brew -v
  14. Homebrew 0.9.5
复制代码
这边提下brew的安装,brew是Mac OS不可或缺的套件管理器
执行下面命令
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

6. node
有了brew安装node就方便了
brew install node

7. npm
guowenxie-macbookair:~ guowenxie$ npm -v
2.0.0-alpha-5
8. Appium
现在可以开始安装Appium



guowenxie-macbookair:~ guowenxie$ appium -v
1.2.09. wd
npm install wd


10. Xcode和Android SDK
这个不说了
11. 检查环境

  1. Appium提供了一个doctor,运行appium-doctor
  2. guowenxie-macbookair:~ guowenxie$ appium-doctor
  3. Running iOS Checks
  4. ✔ Xcode is installed at /Applications/Xcode.app/Contents/Developer
  5. ✖ Xcode Command Line Tools are NOT installed: Error: Command failed: No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
  6. Fix it? (y/n) y
  7. Press any key to continue:
  8. ✔ Xcode Command Line Tools are installed.
  9. ✔ DevToolsSecurity is enabled.
  10. ✔ The Authorization DB is set up properly.
  11. ✔ Node binary found at /usr/local/bin/node
  12. ✔ iOS Checks were successful.
  13. Running Android Checks
  14. ✖ ANDROID_HOME is set but does not exist on the file system at "Users/guowenxie/Documents/adt-bundle_mac-x86_64-20140702/sdk"
  15. Appium-Doctor detected problems. Please fix and rerun Appium-Doctor.
复制代码

这里可以看到我Xcode Command Line Tools没有安装,这个方便,Fix it?的时候输入Y,就能自动导向安装了。
另一个是ANDROID_HOME的环境变量没配置好,那么我们要配置下。
12. bash_profile文件
Mac 默认是没有这个文件的,我们自己建一个

  1. touch .bash_profile

  2. vi .bash_profile
  3. 打开bash_profile文件配置ANDROID_HOME和JAVA_HOME
  4. export ANDROID_HOME="/Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk"
  5. export JAVA_HOME=$(/usr/libexec/java_home)

  6. source .bash_profile
复制代码
好了,再次运行appium-doctor

  1. guowenxie-macbookair:~ guowenxie$ appium-doctor
  2. Running iOS Checks
  3. ✔ Xcode is installed at /Applications/Xcode.app/Contents/Developer
  4. ✔ Xcode Command Line Tools are installed.
  5. ✔ DevToolsSecurity is enabled.
  6. ✔ The Authorization DB is set up properly.
  7. ✔ Node binary found at /usr/local/bin/node
  8. ✔ iOS Checks were successful.
  9. Running Android Checks
  10. ✔ ANDROID_HOME is set to "/Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk"
  11. ✔ JAVA_HOME is set to "/usr/libexec/java_home."
  12. ✔ ADB exists at /Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/adb
  13. ✔ Android exists at /Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools/android
  14. ✔ Emulator exists at /Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools/emulator
  15. ✔ Android Checks were successful.
  16. ✔ All Checks were successful
复制代码

到此,环境基本准备好了。
最后,如果不想通过命令行安装Appium,也可以安装dmg




回复

使用道具 举报

该用户从未签到

发表于 2017-6-29 15:13:28 | 显示全部楼层
麻烦问一下,appium 测试结束后自动生成的测试报告,以及测试过程中发现问题的统计、log的抓取这些是一个怎样的情况呢,有没有已经涉及到了?
回复 支持 反对

使用道具 举报

该用户从未签到

 楼主| 发表于 2017-6-29 15:14:22 | 显示全部楼层
悠悠小仙仙 发表于 2017-6-29 15:13
麻烦问一下,appium 测试结束后自动生成的测试报告,以及测试过程中发现问题的统计、log的抓取这些是一个怎 ...

目前appium是没有提供测试报告的吧,你提到的这些应该算一套方案了,可以单独发帖来讨论
appium 提供了 webhook,可以讲appiu的log 全部导入到你自己的分析工具里去。
回复 支持 反对

使用道具 举报

  • TA的每日心情
    无聊
    2018-7-6 18:55
  • 签到天数: 2 天

    连续签到: 1 天

    [LV.1]测试小兵

    发表于 2017-12-4 18:29:27 | 显示全部楼层
    麻烦请问一下,使用dmg安装的appium,在cmd上使用appium怎么查看版本查看不了??
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-4-19 10:29 , Processed in 0.073115 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表