Software >
Ruby > Ruby web programming, Ruby testing >
(on Wikipedia)
(old website, archive)
was watir.com
A functional testing tool for automating browser-based tests of web applications. It drives the Internet Explorer browser the same way people do. It clicks links, fills in forms, presses buttons. It also checks results, such as whether expected text appears on the page.
I did some simple website testing with it.
- aka Web Application Testing in Ruby.
- Pronounced "water".
- my Watir scripts
- Water 2.0 had support planned for Linux and Firefox using the "selenium" engine. 2019-09-29 - That engine appwars to have become https://www.selenium.dev/
-
Abandoned - 2024-04-22 - No website updates in a while, and the domain is down.
2005-10-19 - (version not recorded) ∞
I've known about Watir for some time now, but I haven't had a good excuse to care about it. Frankly, I still think that textual gaming via Vwmc would be a more thorough introduction to Ruby, but this is a good enough start I suppose.
I've already run into some pretty significant walls, most likely because Watir's documentation is basically absent. I'm tired of seeing bits and pieces of documentation scattered around. Some of Watir's online stuff is fantastic.. but when I look at it's wiki I want to strangle someone. Even its FAQ was awful. It really saddens me when the live documentation isn't kept updated. I guess there aren't very many people who love writing documentation as much as I do.
I'm still poking around for some decent resources.. I expect that in the next couple of weeks the main watir topic will be pretty decent. Seeing as this is a long-term thing, I'm looking for all sorts of peripheral resources too. I'll poke around the mailing list and archives for more stuff.
Installing ∞
Get and install gem
for Windows, and install watir that way. I failed to install watir via a downloaded gem or via the gem windows installer. Go figure.
Running the included tests ∞
If Ruby is installed to C:\ruby
and watir was installed as a gem, then the unit tests are:
C:\ruby\lib\ruby\gems\1.8\gems\watir-1.4.1\unittests
go to the console and enter into that directory, and do a
ruby all_tests.rb
I have no idea how to interpret the results.
Logging ∞
I can get logging to work via Watir:WatirLogger
foo = Watir::WatirLogger.new("test",$ie,100)
but it doesn't do anything.
Logging needs to check for a file, and do proper log rotation, with a nice naming scheme.
Outstanding questions ∞
-
What exceptions are thrown for what situations? I'd like to be able to rescue with some intelligence.
- Invalid URL (target page missing)
- IE window isn't open.
-
Change the methods to log things to a file as well as output to
stdout
-- the existing logging functionality needs to be figured out.- TODO - check out log4r - https://github.com/colbygk/log4r
-
Change the default way things work, so I don't have to use my methods..
- Or put the methods in another file to be included separately.
IRB is stupid ∞
- Ruby can do
require 'watir'
but irb requiresrequire 'Watir'
-
Ruby can use tabs, but pasting into IRB makes it explode in colourful ways. Do
irb --noreadline
Notes ∞
-
- Cucumber and H30 ("watir", "safariwatir", "firewatir")
- Brian Marick is writing Scripting for testers, which will focus on learning by examining and building examples, including working with Watir and possibly Selenium. The manuscript is due by the end of 2005.
$ie.send_keys(key_string)
-- see https://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm- Clearing the IE cache
- Watir Extension Toolkit
Resources ∞
- https://qantom.com/wet/ [ 1 ]
-
https://clabs.org/blog/WebTestingWithRuby
- As of 2019-09-29 it's been gone for some time.
- (archive)
-
https://web.archive.org/web/20090331212848/http://testingreflections.com/
Tutorials ∞
-
Brett Pettichord taught a Watir tutorial at the 2005 Agile conference in Denver.
Other places to go for help and examples ∞
- Watir's included unit tests are cited as being an excellent place to look through, for examples on all of Watir's features.
- Google with:
site:rubyforge.org "[Wtr-general]" your search term - The instiki unit tests
Last updated 2024-04-22 at 11:06:53
Footnotes
- was http://wet.qantom.org/ [ ↩ ]
partly-ported
ported
RIP