L
Luke St.Clair
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
"name".
I'll have a hierarchy of tests cases, in suites, which may help
Is there some way to:
1) set a global variable in the "parent" test suite that the children
see? Seems like the answer to this is no
2) Pass an arg to the test case as a whole? Don't see anyway to do
this in the docs
3) Do something else that will keep this test code compliant with DRY?
What's the right approach here?
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
"name".
I'll have a hierarchy of tests cases, in suites, which may help
Is there some way to:
1) set a global variable in the "parent" test suite that the children
see? Seems like the answer to this is no
2) Pass an arg to the test case as a whole? Don't see anyway to do
this in the docs
3) Do something else that will keep this test code compliant with DRY?
What's the right approach here?