• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 軟件測試中使用ruby制作IE測試程序

    發表于:2009-03-26來源:作者:點擊數: 標簽:軟件測試rubyRuby程序制作
    使用 ruby 制作IE 測試 程序時,很多人可能很快就會想到使用 watir ,其 .net /http也提供強大的IE支持能力,以下例子說明,如何使用net/http來實現數據驅動測試 require’win32ole’#使用win32ole可以操作excell文件,使數據保存在excell文檔中 require’net/http
    使用ruby制作IE測試程序時,很多人可能很快就會想到使用watir,其.net/http也提供強大的IE支持能力,以下例子說明,如何使用net/http來實現數據驅動測試
    require ’win32ole’  #使用win32ole可以操作excell文件,使數據保存在excell文檔中
    require ’net/http’  
    excel = WIN32OLE.new(\"excel.application\") # 定義一個excel對象
    excel.Visible = false  
    excel.WorkBooks.Open(\"d:\\\\default.xls\")   #打開excel文件
    [1,3].each do |j|                        #循環讀取excel文件的sheet,這里的有3個sheet
      sheet = \"Action\" + j.to_s  #sheet的名稱
      excel.WorkSheets(sheet).Activate #激活sheet
      rows = excel.WorkSheets(sheet).UsedRange.Rows.Count  #取得每個sheet的行數
      (2..rows).each do |i|    #循環讀取各個sheet的數據,第一行為數據類型,真實數據從第二行開始
         url = excel.Cells(i,1).value
         urlChar = excel.Cells(i,2).value
         res = Net::HTTP.get_response(URI.parse(url)) #得到服務器的返回的數據
         puts \"價格正序排序狀態\" + i.to_s 
         puts url + \"    \" + urlChar
         puts res.body.include?(urlChar)     #得到是否取得了想要的數據
            ok,通過以上的代碼可驗證,每個頁面從服務器返回的數據是否是正確的

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>