|XP is just a number|
Re: Test::Class and test organizationby adrianh (Chancellor)
|on Mar 22, 2006 at 11:12 UTC||Need Help??|
The problem is that I have classes that have waaaay more functionality than can be tested in one file. So, the recommended organisation of Foo::Bar::Test testing Foo::Bar isn't going to work.
Yes. I need to explain that better in the documentation. For small simple classes it works well, but if you have multiple fixtures multiple classes make excellent sense.
How does the plan get set in these instances? I can run planless, but I'd prefer not to.
It should "just work". runtests() will tot up the number of expected tests in both objects and output an appropriate plan. The key is to just call runtests() the once.
Also Test::Class explicitly checks the number of tests executed for each test method - so even without a plan you'll get a test failure generated by Test::Class if you run to many / few tests. Since this is happening at the method level this is actually safer than a global plan :-)
Is this a sane use of Test::Class? My only exposure to xUnit has been Rails and the tests I wrote there were variations of the stock test, not anything complex.
What I'd do normally is have a separate subclass for each fixture. So in Test::Class I'd do something like:
Not that there is anything wrong with your way TIMTOWTDI and all that :-)