NAME
Test::Mini::TestCase - base class for Test::Mini test cases
SYNOPSIS
package TestSomething;
use parent 'Test::Mini::TestCase';
use Something;
sub setup { ... }
sub test_can_foo { ... }
sub teardown { ... }
DESCRIPTION
This module should usually be the base class for any Test::Mini test cases that you write.
Any method whose name begins with test_
will be automatically run. If you've defined a setup
method, that will be called before each test, and if you've defined a teardown
method, that will be called after each test.
CLASS METHODS
new(%args)
The one valid key you can pass is name, which gives the name of a specific test to run.
INSTANCE METHODS
setup()
Performs any initialisation required for the test, run once before each test. Intended to be overridden by subclasses.
package TestSomething;
use parent 'Test::Mini::TestCase';
use Something;
sub setup { $obj = Something->new(); }
sub test_can_foo {
assert_can($obj, 'foo');
}
teardown()
Test teardown behavior, automatically invoked following each test. Intended to be overridden by subclasses.
package Test;
use parent 'Test::Mini::TestCase';
sub teardown { unlink 'foo.bar' }
sub test_touching_files {
`touch foo.bar`;
assert(-f 'foo.bar');
}
run($runner)
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
.
Returns the number of assertions called by this test.
Most of the time you won't need to override this method.
SEE ALSO
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.