# Test::Unit::Reporter help?

**URL:** <https://www.ruby-forum.com/t/test-reporter-help/53336>\
**Category:** Ruby\
**Created:** [February 1, 2006, 11:25pm UTC](https://www.ruby-forum.com/t/test-reporter-help/53336 "2006-02-01T23:25:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_McMahon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/74df32/32.png) [@Chris\_McMahon](https://www.ruby-forum.com/u/Chris_McMahon)\
**Post date:** [February 1, 2006, 11:25pm UTC](https://www.ruby-forum.com/t/test-reporter-help/53336/1 "2006-02-01T23:25:06Z")

</div>

Crossposted to the Watir list, my apologies:

I’m trying to integrate Test::Unit::Reporter with my little harness  
script below, and struggling. I think I must have a basic  
misunderstanding.

Ideally, I would pass each “test\_cases” array to Reporter and it would  
Do The Right Thing, but that’s not happening.

Immediate error is “…uninitialized constant  
Test::Unit::UI::Reporter::Reporter (NameError)”

##############################  
#ORIGINAL WORKING SCRIPT

TOPDIR = File.join(File.dirname( **FILE** ), ‘…’)  
$LOAD\_PATH.unshift TOPDIR  
require ‘test/unit’  
require ‘fileutils’  
include FileUtils::Verbose

test\_dirs = Dir.glob(“suite\*\*”)

0.upto(test\_dirs.length - 1) do |dirnum|

chdir(test\_dirs[dirnum])  
puts “”  
puts “working in #{test\_dirs[dirnum]}”

test\_cases = Dir.glob("\*rb")

test\_cases.each do |casex|  
puts “running #{casex}”

test\_result = `ruby #{casex}`  
puts test\_result  
end

chdir("…")

end #do  
#########################################

# WHAT I WISH WOULD HAPPEN

TOPDIR = File.join(File.dirname( **FILE** ), ‘…’)  
$LOAD\_PATH.unshift TOPDIR  
require ‘test/unit’  
require ‘fileutils’  
include FileUtils::Verbose

require ‘test/unit/testsuite’  
require ‘test/unit/ui/reporter/reporter’  
@test\_cases = Test::Unit::TestSuite.new  
FileUtils.mkdir\_p ‘build/report’

test\_dirs = Dir.glob(“suite\*”)

0.upto(test\_dirs.length - 1) do |dirnum|

chdir(test\_dirs[dirnum])  
puts “”  
puts “working in #{test\_dirs[dirnum]}”

@test\_cases = Dir.glob("\*rb")

```
  Test::Unit::UI::Reporter::Reporter.run(@test_cases,

```

‘build/report’, :xml)

chdir("…")

end #do

---

<div class="post-metadata">

**Author:** ![Chris\_McMahon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/74df32/32.png) [@Chris\_McMahon](https://www.ruby-forum.com/u/Chris_McMahon)\
**Post date:** [February 2, 2006, 8:12am UTC](https://www.ruby-forum.com/t/test-reporter-help/53336/2 "2006-02-02T08:12:42Z")

</div>

Chris McMahon wrote:

> ```
> Test::Unit::UI::Reporter::Reporter.run(@test_cases, 'build/report', :xml)
> 
> ```

Replace this with

```
  Test::Unit::UI::Reporter.run(@test_cases, 'build/report', :xml)

```

and it might work. At the very least, you’ll be getting some other  
error! 🙂

Alex
