Appium 基于 Ruby 实现的移动 App 自动化测试框架 (AppiumBooster)

debugtalk · 2016年07月21日 · 最后由 思寒_seveniruby 回复于 2016年07月25日 · 2553 次阅读

AppiumBooster

AppiumBooster helps you to write automation testcases in tables, without writing a snippet of code.

write testcases

You can write testcases in any table tools, including MS Excel and iWork Numbers, and even in plain CSV format.

Take DJI+ Discover's login and logout function as an example.

In order to test these functions above, you can write testcases in tables like this.

After the testcases are finished, export to CSV format, and put the csv files under ios/testcases/ directory.

That's all you need to do, and now you are ready to run automation test on your app.

run

Run the automation testcases is very easy. Just execute ruby run.rb in the project root directory.

➜  AppiumBooster git:(master) ✗ ruby run.rb

AppiumBooster will load all the csv test suites and then excute each suite sequentially.

➜  AppiumBooster git:(master) ✗ ruby run.rb
initialize appium driver ...
start appium driver ...
alert accepted!
======= start to run testcase suite: ./ios/testcases/Account-Login and Logout.csv =======
load csv testcase file: ./ios/testcases/Account-Login and Logout.csv ...
B------ Start to run testcase: Login with valid account
step_1: Enter My Account Page
control_element.click    ...    ✓
uiviewMyAccount exsits?    ...    ✓
step_2: Enter Login Page
control_element.click    ...    ✓
uiviewLogIn exsits?    ...    ✓
step_3: Input Email Address
control_element.type 'leo.lee@dji.com'    ...    ✓
step_4: Input Password
control_element.type '123456'    ...    ✓
step_5: Login
control_element.click    ...    ✓
tablecellMyMessage exsits?    ...    ✓
step_6: Check if coupon popup window exists
inner_screen.has_control 'btnViewMyCoupons'    ...    ✓
btnClose exsits?    ...    ✓
step_7: Close coupon popup window
control_element.click    ...    ✓
!btnClose no longer exsits?    ...    ✓
E------ Login with valid account

B------ Start to run testcase: Logout
step_1: Enter My Account Page
control_element.click    ...    ✓
uiviewMyAccount exsits?    ...    ✓
step_2: Enter System Settings
control_element.click    ...    ✓
btnLogout exsits?    ...    ✓
step_3: Click Logout
control_element.click    ...    ✓
Do you want to log out? exsits?    ...    ✓
step_4: Confirm logout alert
alert accepted!
alert_accept    ...    ✓
tablecellMyAccountLogin exsits?    ...    ✓
E------ Logout

============ all testcases have been executed. ============
quit appium driver.

Source Code

GitHub: http://debugtalk.com/post/Introduction-to-AppiumBooster/

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 12 条回复 时间 点赞

这个好东东,是否支持图片对比判断、定制测试执行顺序,设定重复执行循环次数?

#1 楼 @toolsh 都会有的,现在才刚开始做

没 id 的话怎么弄

#3 楼 @pacerron 找研发沟通让加上

看了大哥的源码,没有看到设置端口的地方,有个问题,用 ruby 怎么能实现并发,我是用 python 的,前段时间准备用 ruby 但是发现好像只支持 4723 端口,不知道还有没有其他端口

#5 楼 @ws96apt
可以看下这个,我还没有试过,但应该是可行的。
https://github.com/appium/ruby_lib/blob/master/docs/ios_docs.md

#4 楼 @debugtalk 如果测试的是第三方应用,没有开发支持了。能否使用 UI Automator 里的 Resource ID?

跟 robotframework 类似 你是如何规划的, 要做成一个 robotframework+appium 的框架吗

#8 楼 @seveniruby 规划是最终实现 BDD,在产品做需求的时候,测试根据原型图和交互图写测试用例。整个过程中都是在表格中编写,不会涉及到代码的编写

#9 楼 @debugtalk BDD 这条路难走的. BDD 因为一些固有的缺点一直没在行业里面壮大起来.

#10 楼 @seveniruby 嗯,我想的是现在我所在的团队还算是个创业氛围比较浓厚的团队,这些相对来说都还比较好推动,所以就想尝试去实践下。

除了 BDD,思寒能给些建议么?

#11 楼 @debugtalk 这个不敢, 我其实不看好. BDD 有些华而不实的硬伤还没解决. 解决了会很好. 我也在探索如何突破.

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册