Calabash快速入门(Android )简介本篇包括:
33558 www.Sina.com/: MAC/androidstudio
33558 www.Sina.com/:用calabash实现简单的app自动测试
环境:信用卡长度为16位
目标:构建环境,创建APK,编写并运行测试用例
该过程安装Calabash沙箱并创建app,然后创建测试脚本,在模拟器或实际设备上运行测试脚本,并将其上载到cloudtest.xamarin.coms进行测试。 安装Calabash沙箱-为什么要安装“官方链接”沙箱
togetupandrunningasfastaspossibletousecalabash、 werecommendyouseourrubysandbox.thesandboxisapre-configuredrubyenvironmentthateverythingyouneedtostartexploringcalababash dboxisconfiguredwithesameversionofrubyrunningonxamarin’stest cloud,soyou don’tneedtoworrryabbar
怎么安装?
curl-SSL 3359 raw.github user content.com/calabash/install/master/install-OS x.sh|bash
安装完成后,将显示以下画面
安装成功后,在命令行中运行calabash-sandbox进入沙箱模式
编写程序并生成APK-[官方链接]程序的源代码下载:
下载地址1
下载地址2
打开源代码:
要在android studio中打开源代码,添加互联网访问权限很重要
uses-permission Android 3360 name=' Android.permission.internet ' /创建签名并创建带签名的软件包
在编写测试脚本的“官方链接”沙箱模式下进入项目目录,并在命令行中输入calabash-android gen
features目录将添加到项目目录下,您可以看到my_first.feature是我们的脚本文件
打开my_first.feature文件,然后进行以下更改:
ea ture : credit card validation.creditcardnumbersmustbeexactly 16 characters.scenario : creditcardnumberistolongiveniwang appearwhenienter ' 99999999999 ' intoinputfieldnumber1andipress ' validate button ' thenishouten
$ calabash-android resign
执行脚本
$ calabash-android run
运行流程
执行结果:
要上传到testcloud.xamarin.com进行测试,请访问网站。
测试用例