= WatirCraft
== DESCRIPTION
WatirCraft is a testing framework that builds on Watir.
It allows tests to be expressed as Rspec or Cucumber tests and provides
a library structure to support maintainable testing. It gives you
a place to put things.
* http://testobsessed.com/2008/05/31/a-place-to-put-things
== FEATURES
* Generates a directory structure for your test suite with one command.
* Provides page adapters you can customize for your application.
* Configure environment URLs and browser type (IE, Firefox) in one location.
* Supports multiple environments; specify which to test at run time.
* Uses templates to create tests and libraries.
* Automatically initializes browser for testing.
* Provides the glue to ensure your tests can find your libraries. Don't
write another "require" statement again.
== APPROACH
WatirCraft is an object-oriented testing framework that helps you create
class libraries to support the tests for your application. On their own,
many testers have created procedural libraries for testing because they
understand these and find them easier to create and understand.
Although object-oriented frameworks like WatirCraft are somewhat more difficult
to understand at first, they are easier to customize and upgrade. As we add
more features to the WatirCraft framework, your test suite will automatically
get the benefit.
== INSTALL
Run the following if you haven't already:
> gem update --system
> gem sources -a http://gems.github.com
Install the gem:
> gem install bret-watircraft
See the History.txt file for detailed notes on the contents of each release.
== GETTING STARTED
Use the +watircraft+ command to create your project. Your project will contain
your tests, your libraries, your configuration files, and all the glue code
necessary to allow it all to work together. Let's create a project for
testing Google.
> watircraft google
This will create a directory called "google" and populate it with a bunch of
directories and files.
You'll need to edit the config\environments.yml file to point to you base
url of your project.
test:
url: http://google.com
By default, your tests will run in the "test" environment, but you can specify
additional environments later. When you run your tests, you can specify which environment
to use on the command line.
Use the script\generate command to populate your project with project files.
This command must be run from the top of your project.
> cd google
Create a test. WatirCraft uses the RSpec test harness and therefore calls a
test a "spec".
> script\generate spec search
This creates a bare template for a test. Edit the file that was just created
(test/specs/search_spec.rb) and add the following
lines.
browser.text_field(:name, 'q').set 'WatirCraft'
browser.button(:name, 'btnG').click
browser.text.should include('Test automation for web applications')
The WatirCraft framework will automatically start the browser at the
configured url when you run it.
After you have added these lines to the template, the complete file will
look like this.
$LOAD_PATH.unshift File.dirname(__FILE__) unless
$LOAD_PATH.include? File.dirname(__FILE__)
require 'spec_helper'
describe "Search" do
it "should find WatirCraft" do
browser.text_field(:name, 'q').set 'WatirCraft'
browser.button(:name, 'btnG').click
browser.text.should include('Test automation for web applications')
end
end
Use the +rake+ command to run the tests for your project(only one so far).
This needs to be run from the base of your project.
> rake spec
By default, your test runs with Internet Explorer, but you can also run it
with Firefox.
> rake spec BROWSER=firefox
You can also just run individual files.
> ruby test/specs/search_spec.rb
Note that many editors will do this automatically for you. For example the
Scite editor will do this when you hit "F5".
== EXAMPLE
An example test suite for this framework can be found in the framework
examples project on github. Look in the +watircraft+ directory.
* http://github.com/bret/framework-examples
== QUESTIONS AND FEEDBACK
Known bugs and road map. You can report bugs and request features here.
* http://watircraft.lighthouseapp.com/projects/28400-watircraft/overview
Join our mailing list for WatirCraft users.
* http://tech.groups.yahoo.com/group/watir-framework
The WatirCraft framework is developed by WatirCraft LLC, based on Taza[http://github.com/scudco/taza/wikis].
Please send your comments to us at feedback@watircraft.com[mailto:feedback@watircraft.com]
We love getting your emails.
WatirCraft LLC provides training and consulting for Watir, Ruby and the
WatirCraft framework.
* http://www.watircraft.com
== LICENSE
(The MIT License)
Copyright (c) 2008 Charley Baker
Copyright (c) 2009 Charley Baker, Bret Pettichord
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WatirCraft is a trademark of WatirCraft LLC.