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?
Running a single test in Test::Class (Score:2)
I have a vim mapping to let me run a single test [perl.org].
Basically, Test::Class looks at the TEST_METHOD environment variable and runs all tests matching that value (it accepts regexes, too).
Re: (Score:1)
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: (Score:1)
Vim can do the same. :-)
Re: (Score:2)
Yeah, I get lazy sometimes. I should really fix that :)