Test::Class is very nice, but I realize I've started to use it in a peculiar way that I think is an indication of a missing feature.
Let's say there's a class with quite a few different tests and I'm currently TDD-ing this single method.
sub ion_favourites : Test(no_plan) { # ... }
It's quite annoying to run the whole test class, because all of the test methods are run, not just the one I'm working on. The output of my test is easily lost in the sea of output, and running all of the tests increase the turnaround time.
To only run this test, I temporarily rename it and put an exit at the end:
sub a__ion_favourites : Test(no_plan) { # ... exit(1); }
The naming ordering is actually mentioned in the manual, but seems to be more geared to running sanity checks first.
The full test suite fails becuase of the exit status, but I can easily see whether the stuff I'm working on passes and that's what I care about during TDD.
Smells a bit hacky, but it works. So, does anyone else do this?
I have a vim mapping to let me run a single test.
Basically, Test::Class looks at the TEST_METHOD environment variable and runs all tests matching that value (it accepts regexes, too).
Re:Running a single test in Test::Class
jplindstrom on 2009-08-21T21:36:36
That's ace!
In Emacs it can actually be one level neater; since the tests are run from within Emacs itself it's easy to simply set the env var before kicking off the test run. No need to edit the source file.
Re:Running a single test in Test::Class
Aristotle on 2009-08-22T06:16:38
Vim can do the same.
:-) Re:Running a single test in Test::Class
Ovid on 2009-08-22T08:29:40
Yeah, I get lazy sometimes. I should really fix that
:)