I came across a post where Charley Baker provided this great example
of exporting testcase results to the xUnit XML format:
<><><>
require 'test/unit'
require 'ci/reporter/rake/test_unit_loader.rb'
require 'watir'
class My_Test < Test::Unit::TestCase
def test_me
browser = Watir::IE.start('
http://www.google.com')
assert(browser.link(:text, 'About Google').exists?)
browser.close
end
end
This will dump the xml file to the directory where the test is run in
test/reports/TEST-My-Test.xml
<><><>
That's it?! I was well on my way to making this WAY TOO
COMPLICATED. Thanks Charley!
After reading a bunch of documentation I thought it would roll out
more like:
CruiseControl > Rakefile with the ci-reporter method calls > Watir
scripts > results to XML > consumed by CruiseControl
Whew... sure glad that got worked out.
Have decided to start coding the scripts with the "test-unit" gem/
module. Just seems to expose more about what's actually going on and
probably
better for the learning process right now.
IMHO, 'rspec' seems to obfuscate which assertion is being employed and
where.
But I can see that rspec may offer an easier path to accessing deep
HTML elements (but so will watirs' xpath).
That's another question. rspec v.s. xpath?
It appears the good news is that either way, test results get fed to
the XML file..
Yesterday, I got a good start on scripting some smokeTests and have
multiple testcase methods sending results to the XML file.
In one afternoon I jumped ahead of my dev. team a little bit.
More to follow on the details of the CruiseControl Integration
piece.
I should be able to simply drop one of my result XML files into the
project (location?) and verify it's data gets expressed on the
dashboard.
Good times..
MichaelT