CI::Reporter - tutorial or examples?

757 views
Skip to first unread message

Ruel Loehr

unread,
Sep 6, 2007, 11:02:48 AM9/6/07
to Watir General
We currently have a watir test suite which runs daily inside of
cruisecontrol. It's currently setup up to write results to an html
page, but it is pretty cryptic and not integrated with the
cruisecontrol system.

I'd like to change this over such that reporting is a little easier to
understand and have seen a few references to CI::Reporter. I checked
out the page here:

http://caldersphere.rubyforge.org/ci_reporter and googled around a
bit, haven't seen what I feel is enough info to start.

We have a java web app which is built and deployed. I then fire up
the watir test suite. I'm trying to understand how to integrate the
CI::Reporter into my existing watir tests but have not yet found any
examples.

>From the documentation:

If for some reason you can't use the above technique to inject
CI::Reporter (e.g., you're not using Rake), you'll have to do one of
these:

1. If you're using Test::Unit, ensure the ci/reporter/rake/
test_unit_loader.rb file is loaded or required at some point before
the tests are run.

Perfect. I'm not using rake. I am using Test::Unit, and I can
include test_unit_loader.rb. The next step is to figure out how to
use the api. Are there some basic examples out there anywhere?
E.g. start a testsuite, run a test, record a passing entry, record a
failing entry, write the xml......


Thanks!
Ruel Loehr

Charley Baker

unread,
Sep 6, 2007, 11:26:23 AM9/6/07
to watir-...@googlegroups.com
I think you're overthinking it. This example works, writes out the results in xml (standard xunit style) which can then be picked up by Cruise Control and displayed in it's dashboard.

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

-Charley

Russ DeWolfe

unread,
Sep 6, 2007, 4:48:46 PM9/6/07
to watir-...@googlegroups.com
When I try to run your code, I get this:
 
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:301:in `report_activate_error': Could not find RubyGem builder (>= 0.0.0) (Gem::LoadError)
 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:238:in `activate'
 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:76:in `active_gem_with_options'
 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:50:in `gem'
 from c:/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.3.4/lib/ci/reporter/test_suite.rb:69:in `create_builder'
 from c:/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.3.4/lib/ci/reporter/test_suite.rb:85:in `to_xml'
 from c:/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.3.4/lib/ci/reporter/report_manager.rb:18:in `write_report'
 from c:/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.3.4/lib/ci/reporter/report_manager.rb:17:in `open'
 from c:/ruby/lib/ruby/gems/1.8/gems/ci_reporter-1.3.4/lib/ci/reporter/report_manager.rb:17:in `write_report'
  ... 11 levels...
 from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
 from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
 from c:/ruby/lib/ruby/1.8/test/unit.rb:278
 from test.rb:7
>Exit code: 0
 
 
any idea why?
 
Russ


From: watir-...@googlegroups.com [mailto:watir-...@googlegroups.com] On Behalf Of Charley Baker
Sent: Thursday, September 06, 2007 10:26 AM
To: watir-...@googlegroups.com
Subject: [wtr-general] Re: CI::Reporter - tutorial or examples?

Russ DeWolfe

unread,
Sep 6, 2007, 4:53:41 PM9/6/07
to watir-...@googlegroups.com
just needed to do:
gem install builder


From: watir-...@googlegroups.com [mailto:watir-...@googlegroups.com] On Behalf Of Russ DeWolfe
Sent: Thursday, September 06, 2007 3:49 PM

mberney

unread,
Sep 7, 2007, 11:38:53 AM9/7/07
to Watir General
In our environment, even though the builder gem was installed, these
errors still occurred. It turns out that the test_suite.rb module
required modification. Comment out the lines containing "gem
install..." and you will get around the problem.

Lines 70 & 74 in test_suite.rb (ci_reporter 1.3.3)

We are using:
Ruby 1.8.2.15
Watir 1.5.1.1192

Hope this helps.

Charley Baker

unread,
Sep 7, 2007, 11:51:41 AM9/7/07
to watir-...@googlegroups.com
Those errors can also be fixed by upgrading rubygems. I'm also using Ruby 1.8.2 and ran across the same errors due to the version of rubygems, updated to 0.9.0 and it's working now. There were some changes in the way that gems can be invoked from scripts.

-Charley
Reply all
Reply to author
Forward
0 new messages