Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday February 07, 2006
08:49 PM

Please, please, please, please ... Test::Class

[ #28619 ]

I just submitted a patch for Test::Class. It lets you do this:

TEST_METHOD='.*customer.*' prove t/test_class.t

And that lets you run only those tests with the string "customer" in the method name. The value of the environment variable is a regular expression bound to the beginning and end of the string, so "customer" would only run tests whose method name is "customer". Of course, setup and teardown methods still run.

Right now, our full suite of data store tests takes about two minutes to run. With TEST_METHOD, I can just run the test on the current test method I'm working on (which takes about 9 seconds) and when I get it passing, pull out the environment variable and run the full test suite. This makes for much faster development and a happy Ovid. I want the test suites to bend to my will, not the other way around.

I'm hoping that this patch or a variant of it is accepted.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It'll go in :-)

    I'm gonna mark it as experimental though - since I'm not 100% that some other stuff that I'm playing with at the moment won''t do this in a better way... but the play area is some time from release.

    • Yay! I can easily believe that mine is not the best approach. It just seemed the easiest for me to implement.

      Will your approach allow one to specify the test name/names on the command line? That way, a good editor like vi or emacs can figure out the test that it's in and hand that name off for it to be run.

      • Will your approach allow one to specify the test name/names on the command line?

        Yup. The way I've been thinking about it runtests will take a list of test methods to run (with handy shortcuts to run all the test methods if you give no arguments, all the methods in a class and its children if you give a class, etc.)

        This is nice since you can trivially run one method, or do things like run all test methods with specific "tags" (ala groups in TestNG and friends.), or run whatever other bizzarro test