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. All test cases run the same code, just with
the one (or two) parameters tweaked.
Let’s say I have 150 tests for a Person - I’d rather not end up with
1500 tests, each of the 150 tests exactly duplicated for a different
I’ll have a hierarchy of tests cases, in suites, which may help
Is there some way to:
- set a global variable in the “parent” test suite that the children
see? Seems like the answer to this is no
- Pass an arg to the test case as a whole? Don’t see anyway to do
this in the docs
- Do something else that will keep this test code compliant with DRY?
What’s the right approach here?