Ruby+Watir用例

上一篇 / 下一篇  2014-03-31 15:08:28 / 个人分类:自动化测试

哈哈,安装好了,写一个小例子跑跑看,这是我第一个自动化用例哦,开启自动化之旅
require 'watir' # the watir controller
# open the IE browser
ie = Watir::IE.new
# Step 1: go to the test site: http://www.google.com
ie.goto("https://www.google.com.hk")
# Step 2: enter 'pickaxe' in the search text field
ie.text_field(:name, "q").set("pickaxe")
# Step 3: click the 'Google Search' button
ie.button(:name, "btnK").click
if ie.contains_text("Programming Ruby")
puts "Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results."
else
puts "Test Failed! Could not find: 'Programming Ruby'"
end
# End of test: Google search

TAG: Ruby Watir watir

 

评分:0

我来说两句

日历

« 2024-04-23  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 7088
  • 日志数: 9
  • 建立时间: 2014-03-24
  • 更新时间: 2014-04-15

RSS订阅

Open Toolbar