NAME

Test::Mini::Logger - output logger base class for Test::Mini

DESCRIPTION

This module is the base class for loggers that are going to be used with Test::Mini. By default, Test::Mini uses this class directly, but you can subclass it and ask Test::Mini to use your class instead.

CLASS METHODS

new(%args)

Constructor. Takes a hash of arguments providing initial state. Valid keys are:

verbose - logger verbosity, defaulting to 0
buffer - output buffer, defaults to STDOUT.

ATTRIBUTE ACCESSORS

buffer

Returns the output buffer.

verbose

Returns logger verbosity.

OUTPUT METHODS

print(@msg)

Write output to the buffer. Takes an array of strings, which will be output to buffer without adding any newlines.

say(@msg)

Writes output, adding a newline character to each entry in @msg.

CALLBACKS

begin_test($tc, $test)

Called before each test is run. $tc is the test case owning the test method, and $test is the name of the test method being run.

begin_test_case($tc, @tests)

Called before each test case is run. $tc is the test case being run, and @tests is a list of tests to be run.

begin_test_suite(%args)

Called before the test suite is run. Takes a hash of arguments, valid keys for which are:

filter - test name filter.
seed - seed for the random number generator.

error($tc, $test, $e)

Called when a test dies with an error. Increments the error count. Takes three arguments:

$tc - the test case owning the test method.
$test - the name of the test with an error.
$e - the exception object, an instance of Test::Mini::Exception.

fail($tc, $test, $e)

Called when a test fails. Increments the failure count. Takes the same three arguments as error(), above.

finish_test($tc, $test, $assertions)

Called after each test is run. Increments the test and assertion counts, and finalizes the test's timing. Takes three parameters:

$tc -- The test case owning the test method.
$test -- The name of the test method just run.
$assertions -- The number of assertions called.

finish_test_case($tc, @tests)

Called after each test case is run. Increments the test case count, and finalizes the test case's timing. Takes two arguments:

$tc - the test case just run.
@tests - a list of tests run.

finish_test_suite($exit_code)

Called after each test suite is run. Finalizes the test suite timing. Takes one argument, which is the $exit_code that the tests finished with.

pass($tc, $test)

Called when a test passes. Increments the pass count. Takes two arguments:

$tc - the test case owning the test method.
$test - the name of the passing test.

skip($tc, $test, $e)

Called when a test is skipped. Increments the skip count. Takes the same three arguments as the error() method, described above.

STATISTICS

count

If called with no arguments, this returns the hash of all counters. If you pass the name of one test, it returns just the count for the named test.

time($key)

Used to retrieve timing data for a test suite, test case, or specific test. You can pass one of three argument types:

$self - returns the time for the test suite.
"TestCase" - returns time for the test case.
"TestCase#test" - returns time for the given test in the test case.

Times for units that have not finished should not be relied upon.

Returns the time taken by the given argument, in seconds.

SEE ALSO

Test::Mini

REPOSITORY

https://github.com/pvande/Test-Mini

AUTHOR

Pieter van de Bruggen <pvande@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Pieter van de Bruggen <pvande@cpan.org>

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.