Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
We don't bite newbies here... much
 
PerlMonks  

Re: How to test less with Test::More?

by eserte (Deacon)
on Aug 19, 2004 at 05:09 UTC ( [id://384218]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How to test less with Test::More?

You can do the following:
  • Just define a goto label just before the test you want to run
  • Add option handling to your test script, e.g.
    use Getopt::Long; GetOptions("fast" => \$do_fast_test) or die;
  • After test initialization code, add
    goto FAST_TEST_LABEL if $do_fast_test
  • And call the test with perl -Mblib t/testfile.t -fast
If you have planned the number of tests, then you will get an error that too less tests were run (of course), but you can just ignore this or use no_plan.

Replies are listed 'Best First'.
Re^2: How to test less with Test::More?
by Mr. Muskrat (Canon) on Aug 19, 2004 at 11:50 UTC
    I think that it would make more sense to use a lookup table. Then the test script could execute all tests in a predefined order by default but allow the use of a command line option to run a specific test or set of tests. (And it wouldn't have to use a BASIC-style goto.)
      Too complicated. I need this feature only for quick'n'dirty debugging.
        Too complicated? Then you have too many tests in one file and it's time to split them up into separate test scripts.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://384218]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.