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

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

  • <strong id="5koa6"></strong>
  • 開源Web自動化測試框架——Watir試用手記

    發表于:2010-05-31來源:作者:點擊數: 標簽:自動化框架webWEBWeb
    開源Web 自動化測試 框架——Watir試用手記 軟件測試 Watir 是一個使用 Ruby 實現的開源Web 自動化測試框架 ,相對于那些龐大的商業工具來說,它很小巧,也很靈活,提供的功能也足夠用。最近抽時間試用了一下,感覺還不錯,準備下一步在公司推廣使用。 因為

      開源Web自動化測試框架——Watir試用手記   軟件測試

      Watir 是一個使用 Ruby 實現的開源Web 自動化測試框架,相對于那些龐大的商業工具來說,它很小巧,也很靈活,提供的功能也足夠用。最近抽時間試用了一下,感覺還不錯,準備下一步在公司推廣使用。

      因為 Watir 的網站上用戶手冊、示例代碼以及 FAQ 都維護的不錯,所以已有的東西我就不重復了,在這里簡單介紹一下,如果同行們有興趣,可以一起研究一下。

      1. 腳本示例

      先丟一段腳本給大家看看使用 Watir 來書寫腳本是多么的方便。下面的例子是 Watir 自帶的一段測試 Google 的搜索功能的腳本,不過我只保留了最主要的部分,以使它看起來更簡潔一些:

    clearcase/" target="_blank" >cccccc>

       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 (http://www.google.com)

       # Step 2: enter 'pickaxe' in the search text field

       ie.text_field(:name, "q").set("pickaxe")       # q is the name of the search field

       # Step 3: click the 'Google Search' button

       ie.button(:name, "btnG").click                 # "btnG" is the name of the Search button

       # Actual Result: Check that the 'Programming Ruby' link appears on the results page

       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

      這段腳本要做的事情是打開 Google 的主頁,然后在 Google 唯一的那個文本框內輸入“pickaxe”這個字符串,然后按下“Google 搜索”按鈕,之后驗證搜索結果的頁面中是否包含了“Programming Ruby”這個字符串,并根據結果使用 puts 函數在屏幕上打印不同的信息。腳本中“#”后面的綠色部分是注釋的內容。簡單嗎?說實話要比那些商業工具錄制的腳本還要簡潔和簡單。

      2. 所需要的環境

    原文轉自: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>