Using Raakt in NUnit test (via Watir)

NUnit itself does not have the ability to do functional web testing. However, many feel that it is convenient to have all your tests runnable via NUnit as integration with e.g. CruiseControl.NET becomes simpler.

Scott Hanselman has a blog post describing how to set up NUnit tests that call command line scripts. You can use this to run Using Raakt in Watir tests from NUnit or, if you just want to do Raakt tests, you can use this simple example script:

require 'mechanize'
require 'raakt'
 
agent = WWW::Mechanize.new
page = agent.get("http://www.peterkrantz.com")
 
raakttest = Raakt::Test.new(page.body)
result = raakttest.all
 
if result.length > 0
  puts "Accessibility problems detected:"
  puts result
else
  puts "No measurable accessibility problems were detected."
end