Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

automates test suite

by palette (Scribe)
on Feb 03, 2009 at 07:13 UTC ( #740908=perlquestion: print w/replies, xml ) Need Help??

palette has asked for the wisdom of the Perl Monks concerning the following question:

I am working on a automated test suite. The test suite has many test scripts with .t extn. This .t file has test cases for many scenarios and the scenarios includes running of many .pl files. I am using Test::More to write the .t file and using Test::Harness to get all the .t file running and get the summary at the end.
The issue here is since the .t file runs many .pl files within, the .pl display many warning in the command line the same appears when I run execute_tests. I want to overcome this, ie; I want to have only the test that has run and whether it's passed or failed ie; output of Test::More in the log file.
I have also seen some time execute_test (of Test::Harness) does not display the test results but display only the summary in the log(file to which the output is redirected, parameter of execute_tests)

Replies are listed 'Best First'.
Re: automates test suite
by moritz (Cardinal) on Feb 03, 2009 at 07:24 UTC
    It's rather simple to build your own test harness with TAP::Harness version 3 or newer. For one project I use
    my $h = TAP::Harness->new({ verbosity => -2, merge => 1, ... });

    The merge => 1 takes care that STDERR output is suppressed.

      I am using version 3.
      my %args = ( lib => [ '../lib', '../blib' ], verbosity => -2, merge => 1, ); my $harness = TAP::Harness->new( \%args ); @tests = ('1.t'); my $aggregator = TAP::Parser::Aggregator->new; $aggregator->start(); $harness->aggregate_tests( $aggregator, @tests ); print "aggregate:",$aggregate;

      But this supresses all the output that gets printed on the screen. I want the output of the test script ie; all the 'ok' and 'is' test case outputs as it is, but need to suppress the warning or output of the .pl script that is called from .t
        This wasn't intended as a ready-to-run solution, but as a starting point for you to explore. For example, you could try different verbosity levels.
Re: automates test suite
by Anonymous Monk on Feb 03, 2009 at 07:29 UTC

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://740908]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2023-09-29 00:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found