Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"make test" more verbose in Perl

When I run make test using the normal test harness that CPAN modules have, it will just output a brief summary (if all went well).

t/000_basic.t .......................... ok   
t/001_db_handle.t ...................... ok     
t/002_dr_handle.t ...................... ok     
t/003_db_can_connect.t ................. ok   
... snip ...
All tests successful.
Files=30, Tests=606,  2 wallclock secs 
Result: PASS

If I run the tests individually, they output much more detailed information.

1..7
ok 1 - use DBIx::ProcedureCall::PostgreSQL;
ok 2 - simple call to current_time
ok 3 - call to power() with positional parameters
ok 4 - call to power() using the run() interface
ok 5 - call to setseed with a named parameter
ok 6 - call a table function
ok 7 - call a table function and fetch

How can I run all the tests in this verbose mode? Is there something that I can pass to make test?

like image 317
Thilo Avatar asked Mar 15 '11 03:03

Thilo


2 Answers

The ExtUtils::MakeMaker docs explain this in the make test section:

make test TEST_VERBOSE=1

If the distribution uses Module::Build, it's a bit different:

./Build test verbose=1

You can also use the prove command that comes with Test-Harness:

prove -bv

(or prove --blib --verbose if you prefer long options.) This command is a bit different, because it does not build the module first. The --blib option causes it to look for the built-but-uninstalled module created by make or ./Build, but if you forgot to rebuild the module after changing something, it will run the tests against the previously-built copy. If you haven't built the module at all, it will test the installed version of the module instead.

prove also lets you run only a specific test or tests:

prove -bv t/failing.t
like image 192
cjm Avatar answered Nov 20 '22 10:11

cjm


You can also use the prove command:

prove --blib --verbose

from the unpacked module's top directory. --blib includes the needed directories for a built but not installed module distribution.

like image 9
ysth Avatar answered Nov 20 '22 10:11

ysth