# Testing scheme flawed; correction plan OK?

**URL:** <https://www.ruby-forum.com/t/testing-scheme-flawed-correction-plan-ok/78341>\
**Category:** Ruby\
**Created:** [December 5, 2006, 3:06am UTC](https://www.ruby-forum.com/t/testing-scheme-flawed-correction-plan-ok/78341 "2006-12-05T03:06:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f0a364/32.png) [@richard](https://www.ruby-forum.com/u/richard)\
**Post date:** [December 5, 2006, 3:06am UTC](https://www.ruby-forum.com/t/testing-scheme-flawed-correction-plan-ok/78341/1 "2006-12-05T03:06:00Z")

</div>

Hi,

# My Setup

Program defines class | Test case requires Program for test method  
Roman1 =\> Roman | tc\_TestA.rb =\> Roman1 =\> testA  
Roman2 =\> Roman | tc\_TestB.rb =\> Roman2 =\> testB  
Roman3 =\> Roman | tc\_TestC.rb =\> Roman3 =\> testC

TestRomanNumberGeneration.rb is simply:  
require ‘test/unit’  
require ‘tc\_TestA’  
require ‘tc\_TestB’  
require ‘tc\_TestC’

tc\_TestA generates no test output

tc\_TestB generates:

1. Error  
testB(TestRoman):  
RuntimeError [snip]  
./roman3.rb:9 in ‘initialize’  
[snip]  
[snip]

# My Question

testB is defined in tc\_TestB.rb which requires “require ‘roman2’” …  
so why does it report an error ostensibly caused by roman3.rb?

# My Solution

One cannot have separate files defining (or redefining?) the same  
class, “Roman” in this case.

That seems to be reinforced by diagnostics for testC about redefinition  
of constants, which can only occur in this case if it’s including  
definitions from another program file.

So the way out is to use three different class names (which is sensible  
because I’m testing different versions of the same class). I could  
just do that and not bother posting, but I’d like to know that I won’t  
wind up masking some other problem if the symptom goes away.

Any ideas?

Thanks in Advance,  
Richard
