Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Don't ask to ask, just ask
 
PerlMonks  

tests & logging

by arcnon (Monk)
on Oct 12, 2007 at 01:53 UTC ( #644363=perlquestion: print w/ replies, xml ) Need Help??
arcnon has asked for the wisdom of the Perl Monks concerning the following question:

First off I am using Test::More for my tests. During my testing... approx +40k. I keep receiving 1 or 2 failed tests. Being that I can't die on the error or open a file to write the error, well at least I can't figure out how to achieve this feat. How do the superstars approach this problem?

Is there module or a hack to log the failed test/s? How in the world do you track these type of issues down?

At this point I am at a loss of what to do.

Comment on tests & logging
Re: tests & logging
by syphilis (Canon) on Oct 12, 2007 at 02:44 UTC
    For verbose output on specific test files, just run perl -Mblib t/test.t To log to a file, you could just do perl -Mblib t/test.t >log.txt 2>&1
    (Not sure if that addresses your problem.)

    Cheers,
    Rob
Re: tests & logging
by adrianh (Chancellor) on Oct 16, 2007 at 12:59 UTC
    Is there module or a hack to log the failed test/s? How in the world do you track these type of issues down?

    Are all 40k tests in one file? If not just run the test file that's failing.

    You can also use runtests from TAP::Harness with the -q or -Q option to only show test failure.

      Are all 40k tests in one file?
      In that case I would seriously consider splitting the tests into smaller sets (i.e. files). Current modules on CPAN could serve as examples, e.g. a simple and easily understood one such as Number::Bytes::Human. Some test files contain just a handful tests/lines each:
      [Number-Bytes-Human-0.07]# wc -l t/* 7 t/01use.t 42 t/02basic.t 27 t/03large.t 31 t/04base1000.t 14 t/05zero.t 15 t/06si.t 9 t/07unit.t 29 t/08base1M.t 137 t/10parse_args.t 17 t/20oo.t 8 t/90pod.t 8 t/98pod-coverage.t 344 total
      Run all tests:
      [Number-Bytes-Human-0.07]# make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/01use.............ok 1/1# Testing Number::Bytes::Human 0.07, Perl 5. +008005, /usr/bin/perl t/01use.............ok t/02basic...........ok t/03large...........ok 1/4number too large (>= 1024**10) at t/03large. +t line 26 t/03large...........ok t/04base1000........ok t/05zero............ok t/06si..............ok t/07unit............ok t/08base1M..........ok t/10parse_args......ok t/20oo..............ok t/90pod.............ok t/98pod-coverage....ok All tests successful. Files=12, Tests=128, 1 wallclock secs ( 0.89 cusr + 0.10 csys = 0.9 +9 CPU)
      Run a single test:
      [Number-Bytes-Human-0.07]# prove t/05zero.t t/05zero....ok All tests successful. Files=1, Tests=6, 0 wallclock secs ( 0.05 cusr + 0.00 csys = 0.05 C +PU)
      --
      Andreas

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://644363]
Approved by grep
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2014-04-16 07:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (417 votes), past polls