Calabash 快速入门 (Android)
2016-03-18 18:35
393 查看
Calabash 快速入门 (Android)
概述
本篇包括以下内容:环境:mac/android studio
目标:用Calabash实现一个简单app的自动化测试
测试用例:信用卡的长度为16位
实现过程:搭建环境,编写APK,写测试用例,运行
流程
安装Calabash沙箱编写app
写测试脚本
在模拟器或者真机上运行测试脚本,以及上传到cloudtest.xamarin.coms上进行测试。
安装Calabash沙箱-[官方链接]
为什么安装沙箱?To get up and running as fast as possible to use Calabash, we recommend you use our Ruby Sandbox. The sandbox is a pre-configured ruby environment that has everything you need to start exploring Calabash and running tests right away. The sandbox is configured with the same version of Ruby running on Xamarin’s Test Cloud, so you don’t need to worry about ruby compatibilities.
如何安装?
curl -sSL https://raw.githubusercontent.com/calabash/install/master/install-osx.sh | bash
安装完成后,你会看到如下画面
安装成功后,在命令行执行calabash-sandbox进入沙箱模式
编写程序,生成APK-[官方链接]
程序源码下载:下载地址1
下载地址2
打开源码:
用android studio打开源码,很重要的一点是添加上网权限
<uses-permission android:name="android.permission.INTERNET" />
创建一个签名,打一个带签名的包
写测试脚本[官方链接]
在沙箱模式下进入工程目录,在命令行中输入calabash-android gen此时会发现工程目录下添加了一个features目录,my_first.feature即为我们的脚本文件
打开my_first.feature文件,改成如下内容:
Feature: Credit card validation. Credit card numbers must be exactly 16 characters. Scenario: Credit card number is too long Given I wait for the "MainActivity" screen to appear When I enter "99999999999999999" into input field number 1 And I press "validateButton" Then I should see "Credit card number is too long."
运行脚本
重签APK$ calabash-android resign
运行脚本
$ calabash-android run
运行过程
运行结果:
上传testcloud.xamarin.com进行测试请参见网站。
2016年3月18日记于此与君共勉。
相关文章推荐
- 客户同步的脚本
- 希尔排序(shell‘ sort)
- Oralce SQLPlus 以及shell脚本中spool输出到文件时的格式化输出
- shell传入参数的处理
- shell脚本一键安装mysql5.7.x
- TLCL学习笔记
- 使用Xshell&Xftp实现远程登录及文件传输
- linux 改变shell
- 【Linux】shell字符串分割、数组访问、条件判断
- Hbase常用shell
- 输入adb shell 时 提示error: more than one device and emulator
- shell命令-head/tail
- dll和opencv和shell的关联
- struts2和sybase和shell的关联
- Xshell 更改字体配色
- sed 引入shell变量
- shell
- shell脚本
- shell脚本
- shell中的浮点数运算