On Mar 23, 2:38 ¨Βν¬ ΠθμιΌπθμιπ²®®®ΐηναιμ®γονχςοτεΊ
> Luke St.Clair wrote:
> > I need to run the same unit test case more than 10 times (around 150
> > tests in the test case), with 2-3 parameters changed each time.
>
> > For instance, if I had unit tests to examine a "Person", with a
> > required parameter "name" - let's say I want to run the same
> > Test::Unit::TestCase on 10 different people, with different names but
> > everything else the same.  ¨Βμμ τεστ γασεςυτθσανε γοδεκυστ χιτθ
> > the one (or two) parameters tweaked.
>
> Put all the test_ methods into a module, and include it into 10 differentuites:
>
> class ATest < Test::Unit::TestCase; include Suite; setup; @me = 'a'; end; end
> class BTest < Test::Unit::TestCase; include Suite; setup; @me = 'b'; end; end
> class CTest < Test::Unit::TestCase; include Suite; setup; @me = 'c'; end; end
> class DTest < Test::Unit::TestCase; include Suite; setup; @me = 'd'; end; end
>
> there might be a less effusive way, but the Abstract Test Pattern is very
> important to learn, so this is a good start...
>
> > What's the right approach here?
>
> Abstract Test is best to match an important class hierarchy in your code.
> Otherwise, the question arises are you missing an abstraction? Could you
> simplify something else, and test fewer permutations?

I think this is what I'm going to go with - I'll have a test case for
each possible param value (there are about 10), and each one will set
a few additional global variables.  Then, each test case will include
the same module, which will call functions with params set by the
global variables.

Seems to be very DRY, as long as the set of param values is small (it
is in this case, and should stay small in the future).

Thanks -