About Faucets
Faucets is a set of fixtures that let you write web acceptance tests that will run on the RubyFit server using Watir. Tests are independent from screen layout and therefore can be used in test-first development. The syntax is simple and only require minimal understanding of HTML. No programming knowledge is required. Watir uses an OLE object to script and query Internet Explorer.
As an example, here is how you would test google's spell check feature:
| Faucets::Commands | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| open | http://www.google.com | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type | name=q | javaz language | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| click | name=btnG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assertText | id=spellCheckedId | java language | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This is a hypotetical test, since google does not put an id on their spell checked link. If this was your site and you wanted to test it, all you would have to change is add an id to the link.
Installation
Faucets requires ths installation of Ruby, Watir, RubyFit and FitNesseThe 1.0 Beta version of Faucets was tested using
Ruby 1.8.4-19 Final
Watir 1.4.1
RubyFIT 1.1
FitNesse 20060719
First, you should install Ruby, and then download and install the .gem files for Watir and RubyFit. Then download and install FitNesse, and lastly download Faucets.zip and extract it in the folder of your choice.
Next, you will want to run the Faucets unit tests:
copy the sample pages used by the tests:
copy \faucets\faucetsTestPages \FitNesse\FitNesseRoot\files
copy the tests:
copy \faucets\RubyTests \FitNesse\FitNesseRoot
You obviously need to adjust these path to match your installation
You should be able to start FitNesse at this point and load this URL in a browser:
http://localhost/RubyTests
Edit this page and adjust the various paths to match your installation. Follow the FaucetUnitTests link on the RubyTest page, and run that page as a suite. If your installation is correct, all tests should pass. At this point, you could create a page as a sibling of FaucetUnitTests and start writing your own tests from there.
How it started
When a friend and coworker told me about Watir, we immediately saw the potential to automate tests for the navigation and basic functionality of our web application. We already had a large suite of unit and functional tests for the business tier, but the web tier had almost none. Several attempts in the past resulted in difficult to write and/or maintain tests. We wanted the tests to be easy to write and maintain, not require programming knowledge, and as much as possible usable in test-first development. I thought of using FitNesse to create and run the tests through a Ruby fixture. Realizing something similar might have already been implemented, I searched the web and found Selenium. It looked very promising. I installed and tested it, but soon found some real blockers. Nevertheless, I used the Selenium API as a guide for the one I was building. Faucets was written over the course of a few days and put to use. We updated and evolved it over the next few weeks, and it has been pretty stable ever since. After over 1 year of continuous use and 100's of tests written, Faucets still lives up to the task. We felt is was ready to be released as open source.Known issues
Faucets was developped in an Extreme Programming environment, so it contains only the features that are needed to test our web application. For example. the type of tags that you can apply click on is not nearly exhaustive. All requests for features and tag support that fall within the spirit of this testing tool will be answered promptly. The best way to submit a feature request is to submit a failing unit test and, if necessary, html page as a proposed storyWe have encountered some problems using IE to run FitNesse when used for Faucets tests that include javascript popups. Our normal setup is to use Firefox to run FitNesse.
Faucets will only test your site in IE. I have not tested any version of FireWatir.