Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

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


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 15: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-24 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found