简单地说,Watir是RUBY版本的自动化测试工具,支持Chrome/IE/FIREFOX,其中IE支持最佳,FIREFOX次之。Chrome平台只支持WINDOWS下,过一段时间会支持更多。
WatiN是C#版本的自动化测试工具,没有了RUBY脚本语言的优势,但速度很快,2.0的正式版本已经快要释出了。它支持IE最好。
RUBY版本的原理很简单,在游览器上加载了插件,而后使用自定义的通讯协议和游览器进行通讯,进行自动化测试工作。
测试环境:Ubuntu 9.04
==============================
1、安装
#参考http://wtr.rubyforge.org/install.html
#安装ruby
sudo apt-get install ruby-full
#安装rubygems
sudo apt-get install rubygems
#使用gem安装firewatir
sudo gem install firewatir
#安装LINUX下的FIREFOX3插件
http://wiki.openqa.org/download/attachments/13893658/jssh-20080725-Linux.xpi
#安装FIREBUG
http://getfirebug.com/
2、测试
#Include the FireWatir file.
require 'rubygems'
require 'firewatir'
#include the FireWatir Module.
include FireWatir
ff=Firefox.new
#Open yahoo mail.
ff.goto("http://lemonhall.dyndns.org/trunk/test/testjson.html")
print ff.html;
#Close the browser.
ff.close