Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Info about Test::Harness

by Kashratul (Acolyte)
on Mar 27, 2008 at 09:27 UTC ( #676666=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks,

I have a perl file that uses selenium to open gmail -> log in -> log out.

The code is working correctly.

I have used Test::Harness just for a try.

use Test::Harness (runtests, execute_tests) ; @test_files = qw (gmail_selenium.pl); execute_tests(tests => \@test_files);

This is working correctly.

Now if I modify the code little bit:

use Test::Harness (runtests, execute_tests) ; @test_files = qw (gmail_selenium.pl); $total = execute_tests(tests => \@test_files); print $total->{max};
All is working correctly but the last line is not getting printed.

As per the information in CPAN (Test::Harness) => "Returns a list of two values, $total and $failed, describing the results."

I felt $total->{max} will return the total number of test runned (based on the info given in CPAN).

Can some one guide me why this is not getting printed?

Thanks

Replies are listed 'Best First'.
Re: Info about Test::Harness
by Anonymous Monk on Mar 27, 2008 at 09:34 UTC
    you want runtests
Re: Info about Test::Harness
by leriksen (Curate) on Mar 28, 2008 at 02:17 UTC
    Because execute_tests returns a list of two items, you end up assigning the fail results to $total (the last thing in the list - lookup "list assignment in a scalar context" and "comma operator" to find out why).

    If you want the totals hash ref, do this

    ($total, undef) = execute_tests(...);

    ...reality must take precedence over public relations, for nature cannot be fooled. - R P Feynmann

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2020-07-07 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?