0

I am new to Calabash - Android. I set up the environment. I would be really grateful if an expert in this arena , who is thorough with the whole concept, could help me with this. I found many IDEs like Eclipse, IntelliJ and editors like Sublime, TextWrangler, etc. I am confused about which one to choose for an ideal Android developer. I am familiar with Ruby, but not an expert. Should I improve my knowledge on Ruby ? Also, if anyone can help me by providing some URLs, I would be really grateful to you. I found many questions on Stackoverflow itself, but I couldn't find anything which is a complete guide for a novice like me. I hope somebody can help me

4

1 回答 1

1

葫芦-ANDROID指南

您无需成为编写功能测试用例或使用 QA 添加新测试场景的 Ruby 专家。Android 开发人员可以轻松地工作,从 github ( https://github.com/calabash/calabash-android ) 签出 Calabash-Android 并将其添加到您的 IDE。尝试了解如何在框架中编写步骤定义,您可以像在框架中编写一样为您的项目编写 Ruby 步骤定义。此外,您可以使用固定步骤(但不推荐)。我在这里解释了我为使用 Calabash - Android 实现功能测试而遵循和探索的步骤。

先决条件 我假设,您已经设置了 Calabash 环境、Android SDK、Java、Ruby 等(运行 Android 应用程序和 Calabash 所需的所有东西)。我正在使用 Genymotion,因为我发现它是最快的模拟器。您需要为 Ruby & Cucumber 选择一个 IDE。因为我使用的是 Android Studio,所以我更喜欢使用 IntelliJ。所以,我正在使用 RubyMine

熟悉 Calabash 控制台并确保一切正常并首先在控制台上尝试。

Calabash 控制台
先决条件确保您的 Genymotion 模拟器正在运行

  • 为了轻松引用 apk,请将其导出(在 Mac 或 Ubuntu 中) export APK=your_application.apk

  • Resign apk calabash-android resign $APK (确保您使用相同的 keystone 证书(签名)进行辞职)

  • 打开葫芦控制台calabash-android控制台$APK

  • 启动测试服务器 找不到此应用程序和葫芦版本组合的测试服务器。重新创建测试服务器。完成对测试服务器的签名。将其移至 test_servers/24433decbe6bdd96b13b9b58258231a8_0.4.20.apk irb(main):001:0> start_test_server_in_background

返回 IRB 父方法(Calabash 控制台):irb(main):012:1> end 参考 URL: http ://www.ruby-doc.org/stdlib-2.0/libdoc/irb/rdoc/IRB.html

供您参考,我添加了一些我尝试过的流行查询:

irb(main):017:0> acceptBtn = query("Button marked:'Accept'")
touch(acceptBtn)
query("relativelayout")
query("homeimagebutton")
logOn = query("homeimagebutton id:'home_log_on'")
touch(logOn)
element_exists("* hint:'Search by address, city or zip'")
wait_for_elements_exist( ["* hint:'Search by address, city or zip'"], :timeout => 2)
wait_for_elements_exist( ["* text:'Log On'"], :timeout => 2)

使用 IRB 时: Cntrl + D :如果输入了错误的命令,请使用此命令获取提示 例如。如果您键入 irb(main):002:0> query("*) irb(main):003:1" 以返回提示,请执行 Cntrl + D 现在您会收到类似 irb(main):003:1> 的提示此处键入“end”,如下所示: irb(main):003:1> end 现在它显示语法错误并得到如下提示: SyntaxError: (irb):2: unterminated string meet end of file (irb): 2:语法错误,意外的输入结束,期望来自 /.rvm/rubies/ruby-2.1.1/bin/irb:11:in `' irb(main):004:0> 的 ')'

在屏幕中搜索文本: text = query('android.view.View','text') text = text.to_s text.include?'test message'

一些有用的 URL 是:
[ http://developer.xamarin.com/guides/testcloud/calabash/] [ http://referenceforu.blogspot.com/2013/08/calabash-android-tutorial.html] [ http ://blog.lesspainful.com/2012/03/07/Calabash/]
了解如何使用 IRB 轻松升级 Ruby [ http://rvm.io/]
了解如何设置多个应用程序: [ http ://blog.lesspainful.com/2013/03/15/Testing-Multiple-Android-Apps/]

于 2014-07-05T23:51:58.727 回答