calabash简介:
Calabash-android是支持android的UI自动化测试框架,PC端使用了cucumber框架,通过http和json与模拟器和真机上安装的测试apk通信,测试apk调用robotium的方法来进行UI自动化测试,支持webview操作。
1 安装ruby,下载地址:http://rubyinstaller.org/downloads/
2 安装JDK,下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
安装成功后,设置环境变量
JAVA_HOME=C:\Program Files\Java\jdk1.
7
.0_65
在Path添加内容:
";%JAVA_HOME%\bin;%JAVA_HOME%\..\jre\bin"
3. 安装Android-SDK
若google的官方网站打不开,可以访问:http://www.androiddevtools.cn/
下载成功后,设置环境变量:
ANDROID_HOME=D:\adt-bundle-windows-x86_64-
20140702
\sdk
4.安装Ant,网址:http://ant.apache.org/bindownload.cgi 设置环境变量:
ANT_HOME=D:\apache-ant-
1.9
.
4
Path添加内容:
";%ANT_HOME%\bin"
5.安装Dev-Kit,下载地址为:http://rubyinstaller.org/downloads/
下载后点击exe文件,将其解压,如解压到C:\DevKit
。具体安装过程可参考https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
6
.gem安装android-calabash
设置gem的仓库为taobao
- C:\Users\asus>gem sources -l
- *** CURRENT SOURCES ***
- http://rubygems.org/
- C:\Users\asus>gem sources --remove http://rubygems.org/
- source https://rubygems.org/ not present in cache
- C:\Users\asus>gem sources -a http://ruby.taobao.org/
- http://ruby.taobao.org/ added to sources
- C:\Users\asus>gem sources -l
- *** CURRENT SOURCES ***
- http://ruby.taobao.org/
用gem命令安装calabash-android
- C:\Users\asus>gem install calabash-android
- ...
- Installing RDoc documentation for escape-0.0.4...
- Installing RDoc documentation for calabash-android-0.5.1...
- C:\Users\asus>calabash-android version
- 0.5.1
7.下载测试用例: https://github.com/bootstraponline/calabash_android_example
8.设置命令行字体:cmd中输入:chcp 65001
,具体可参考:http://blog.sina.com.cn/s/blog_628e2ab30101ajcg.html
9. 进入测试用例目录,输入calabash-android run com.github.mobile_1.6.1.apk