免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4085 | 回复: 3
打印 上一主题 下一主题

关于watir selenium和webdriver soda cucumber [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-11-29 14:20 |只看该作者 |倒序浏览
关于watir selenium和webdriver soda cucumber









watir和selenium在自动化测试web测试领域强硬增长。这一趋势日渐强势,各种搭配和框架丛生。

简单的搜集,我看到了cucumber配合watir的框架,看到例教,和类似的测试集成框架,也看到分布式测试框架


简单使用:

安装
Ruby代码
  1. gem install watir-webdriver  

  2. gem install watir-webdriver
复制代码
Ruby代码
  1. require 'watir-webdriver'  
  2. b = Watir::Browser.new  
  3. b.goto 'bit.ly/watir-webdriver-demo'  
  4. b.text_field(:id => 'entry_0').set 'your name'  
  5. b.select_list(:id => 'entry_1').select 'Ruby'  
  6. b.select_list(:id => 'entry_1').selected? 'Ruby'  
  7. b.div(:class => 'ss-form-entry').button.click   
  8. b.text.include? 'Thank you'  
  9. #webdriver通用watir语法   
  10. browser.goto('http://myserver/mypage')   
  11. # to enter text into a text field - assuming the field is named 'username'   
  12. browser.text_field(:name, 'username').set('Paul')   
  13. # if there was a text field that had an id of 'company_ID', you could set it to 'Ruby Co':   
  14. browser.text_field(:id ,'company_ID').set('Ruby Co')   
  15. # to click a button that has a caption of 'Cancel'   
  16. ie.button(:value, 'Cancel').click  


  17. require 'watir-webdriver'
  18. b = Watir::Browser.new
  19. b.goto 'bit.ly/watir-webdriver-demo'
  20. b.text_field(:id => 'entry_0').set 'your name'
  21. b.select_list(:id => 'entry_1').select 'Ruby'
  22. b.select_list(:id => 'entry_1').selected? 'Ruby'
  23. b.div(:class => 'ss-form-entry').button.click
  24. b.text.include? 'Thank you'
  25. #webdriver通用watir语法
  26. browser.goto('http://myserver/mypage')
  27. # to enter text into a text field - assuming the field is named 'username'
  28. browser.text_field(:name, 'username').set('Paul')
  29. # if there was a text field that had an id of 'company_ID', you could set it to 'Ruby Co':
  30. browser.text_field(:id ,'company_ID').set('Ruby Co')
  31. # to click a button that has a caption of 'Cancel'
  32. ie.button(:value, 'Cancel').click
复制代码
这一篇,夜猪希望开个头,加强关注这个领域,列一些资源,有机会的话更多学习和接触。
资源一部分:

书籍watirbook

watir-webdriver不同系统的安装简单应用

watir Podcast

watir Cheat sheet快速差语法用

watir不错的Tutorial

soda是用于测试nodejs的selenium client端

selenium的client是之前夜猪自己就一直在用和cucumber配合用的。

在测试的时候,很希望能停下来用firebug测debug一下,就会用到
capybara-firebug

Ruby代码
  1. # located in features/support/capybara.rb or similar   
  2. require 'capybara/firebug'  
  3. Selenium::WebDriver::Firefox::Profile.firebug_version = '1.8.3'  
  4.   
  5. profile = Selenium::WebDriver::Firefox::Profile.new  
  6. profile.enable_firebug   
  7.   
  8. Capybara::Driver::Selenium.new(app,   
  9.    :browser => :remote,   
  10.    :url => "http://my.ip.add.ress:4444/wd/hub",   
  11.    :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile))  
复制代码

论坛徽章:
0
2 [报告]
发表于 2011-11-29 16:57 |只看该作者
不错 学习了

论坛徽章:
0
3 [报告]
发表于 2011-11-29 16:57 |只看该作者
不错 学习了

论坛徽章:
0
4 [报告]
发表于 2011-11-30 05:46 |只看该作者
夜猪?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP