NAME

Test::Mini::TestCase - Base class for Test::Mini test cases

METHODS

Class Methods

new
new($class, %args) 

Constructor.

Parameters:

  • (Hash) %args -- Initial state for the new instance.

Valid Options for %args:

  • name -- The specific test this instance should run.

Instance Methods

run
run 

Runs the test specified at construction time. This method is responsible for invoking the setup and teardown advice for the method, in addition to ensuring that any fatal errors encountered by the program are suitably handled. Appropriate diagnostic information should be sent to the supplied $runner.

Parameters:

  • (Test::Mini::Runner) $runner

Returns:

  • The number of assertions called by this test.

setup
setup($self) 

Test setup behavior, automatically invoked prior to each test. Intended to be overridden by subclasses.

Examples:

package TestSomething;
use base 'Test::Mini::TestCase';

use Something;

sub setup { $obj = Something->new(); }

sub test_can_foo {
    assert_can($obj, 'foo');
}

See Also:

teardown
teardown($self) 

Test teardown behavior, automatically invoked following each test. Intended to be overridden by subclasses.

Examples:

package Test;
use base 'Test::Mini::TestCase';

sub teardown { unlink 'foo.bar' }

sub test_touching_files {
    `touch foo.bar`;
    assert(-f 'foo.bar');
}

See Also: