Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I'm not seeing anyway to do this within the module

choroba and 1nickt already pointed you to prove, which I think is the best answer, but just to answer this part of the question, yes, there are ways to get at the test results from within the test script itself, although that isn't really how the test architecture works - test scripts generate TAP output which is then consumed by harnesses to generate the statistics etc. across multiple test files.

If tests in an individual script fail, you already get an output like "# Looks like you failed 5 tests of 30." at the end of the test script. To get at this information yourself, Test::More->builder->details returns a list of hashes that you can inspect yourself (see Test::Builder):

my ($passed,$failed) = (0,0); my @tests = Test::More->builder->details; for my $test (@tests) { if ($test->{ok}) {$passed++} else {$failed++}; } diag "Of ".(0+@tests)." tests, $passed passed and $failed failed.";

Now AFAIK and as far as I can tell from looking at the source, what prove does is use TAP::Harness, which in turn uses TAP::Parser and TAP::Formatter::Base to generate the summary output. But again, it's much easier to just use prove.


In reply to Re: Print summary of tests results when using Test::More ? by haukex
in thread Print summary of tests results when using Test::More ? by perl4life

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found