您的位置:軟件測(cè)試 > 開(kāi)源軟件測(cè)試 > 開(kāi)源功能測(cè)試工具 > Watir
基于watir的框架watircraft
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2013/12/4 11:16:33 ] 推薦標(biāo)簽:

watircraft 是基于watir的BDD(行為驅(qū)動(dòng)開(kāi)發(fā))

安裝:
要先裝ruby環(huán)境
gem install bret-watircraft --remote

使用:
以google為例

1.運(yùn)行- cmd,輸入:watircraft google。google為項(xiàng)目名稱,這里會(huì)生成批量的文件和目錄。

2.打開(kāi)config/environments.yml,編輯文件如下:
    test:
    url: http://www.google.com

3.dos里輸入:cd google

4.dos里輸入:scriptgenerate spec search

5.編輯test/specs/search_spec.rb
如下:
$LOAD_PATH.unshift File.dirname(__FILE__) unless
  $LOAD_PATH.include? File.dirname(__FILE__)
require 'spec_helper'

describe "Search" do

  # TODO: Change this string to describe your test
  it "should find WatirCraft" do
    # TODO: Add your test steps here. Remove "pending" 
    browser.text_field(:name, 'q').set 'WatirCraft'
        browser.button(:name, 'btnG').click
        browser.text.should include('Test automation for web applications')

  end
 
  # TODO: Add additional tests here. Each test should look like
  #  it "test description" do
  #    ... test steps ...
  #  end
end

6. 執(zhí)行search_spec.rb
   rake spec
  或 ruby test/specs/search_spec.rb

軟件測(cè)試工具 | 聯(lián)系我們 | 投訴建議 | 誠(chéng)聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd