Watir (Web Application Testing in Ruby) is a great functional testing framework for web applications. However, newcomers often have difficulties. If you do, you may find this useful.
Use TestWise RubyShell
TestWise Rubyshell is a pre-packaged Watir software on Windows platform.
- Install TextWise RubyShellDownload latest RubyShell installer, double click rubyshell-1.x.x-setup.exe to install, accept all default options.
(Default to c:\rubyshell) - Try out: WatirYou are ready to run Watir scripts. Start a Window command window,
1.
cd
C
:\rubyshell\samples\watir
2.
ruby google_watir.rb
- Try out: Watir with RSpec + ReportsDouble click C:\rubyshell\samples\watir_rspec\demo.bat
Use RubyInstaller and install Watir manually
- Install RubyInstall Ruby (recommending v1.8.7) using the one-click installer for Windows.
- Install WatirStart a Windows command window (if you are unfamiliar with this, you'd better try TestWise IDE)
gem install watir
If you behind a firewall and need proxy to access Internet,gem install -p http://proxy_server:proxy_port watir
- Create a sample Watir script fileOpen notepad, paste into the text below,
1.
require
'watir'
2.
3.
browser = Watir::
IE
.start(
"http://google.com"
)
4.
browser.text_field(
:name
,
"q"
).set
"Watir IDE"
5.
browser.button(
:name
,
"btnG"
).click
- Run Watir scriptStart a Windows command window,
1.
cd
C
:\
2.
ruby c:\google_watir.rb
Use TestWise IDE
Create, edit, manage and run Watir/RWebSpec test scripts in single tool.
- Install TestWise IDEDownload free TestWise Community Edition installer, double click TestWise-1.x.x-setup.exe to install, accept all default options.
- Startup TestWise IDEYou may launch TestWise after the installation (default)Or start up normally
- Try it outTestWise will load the sample project if it is first time.
If not, close current project, click menu File -> Open Project, then choose c:\Program File\TestWise\samples\demo-watir\demo-watir.tprproject file.Select the file hello_world_watir.rb on the left, the test script will be opened in the editor.Right mouse click in the editor, select 'Run Ruby script'An Internet Explorer will be started to run the Watir script.
No comments:
Post a Comment