三里屯摇滚 发表于 2011-11-29 14:20

关于watir selenium和webdriver soda cucumber

关于watir selenium和webdriver soda cucumber








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

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


简单使用:

安装
Ruby代码gem install watir-webdriver

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


require 'watir-webdriver'
b = Watir::Browser.new
b.goto 'bit.ly/watir-webdriver-demo'
b.text_field(:id => 'entry_0').set 'your name'
b.select_list(:id => 'entry_1').select 'Ruby'
b.select_list(:id => 'entry_1').selected? 'Ruby'
b.div(:class => 'ss-form-entry').button.click
b.text.include? 'Thank you'
#webdriver通用watir语法
browser.goto('http://myserver/mypage')
# to enter text into a text field - assuming the field is named 'username'
browser.text_field(:name, 'username').set('Paul')
# if there was a text field that had an id of 'company_ID', you could set it to 'Ruby Co':
browser.text_field(:id ,'company_ID').set('Ruby Co')
# to click a button that has a caption of 'Cancel'
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代码# located in features/support/capybara.rb or similar   
require 'capybara/firebug'
Selenium::WebDriver::Firefox::Profile.firebug_version = '1.8.3'

profile = Selenium::WebDriver::Firefox::Profile.new
profile.enable_firebug   

Capybara::Driver::Selenium.new(app,   
   :browser => :remote,   
   :url => "http://my.ip.add.ress:4444/wd/hub",   
   :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile))

zuerrong 发表于 2011-11-29 16:57

不错 学习了

zuerrong 发表于 2011-11-29 16:57

不错 学习了

2gua 发表于 2011-11-30 05:46

夜猪?
页: [1]
查看完整版本: 关于watir selenium和webdriver soda cucumber