|
|
| |
Badger::Test::Manager(3) |
User Contributed Perl Documentation |
Badger::Test::Manager(3) |
Badger::Test::Manager - test manager module
use Badger::Test::Manager;
# object methods
my $manager = Badger::Test::Manager->new( plan => 7 );
$manager->ok($bool, 'This is a test');
$manager->pass('This is ok');
$manager->fail('This is not ok');
$manager->is($this, $this, 'This and that are equal');
$manager->isnt($this, $this, 'This and that are not equal');
$manager->like($this, qr/that/, 'This is matched by that');
$manager->unlike($this, qr/that/, 'This is not matched by that');
# class methods
Badger::Test::Manager->plan(7);
Badger::Test::Manager->ok($bool, 'This is a test');
Badger::Test::Manager->pass('This is ok');
Badger::Test::Manager->fail('This is not ok');
# ... plus is(), isnt(), like() unlike() methods, as above
This module implements a simple test manager for Badger::Test.
All methods can be called as class methods or object methods. In the case of
class methods, they are called against a prototype object returned by the
prototype() method inherited from Badger::Prototype.
How many tests you plan to run. An error will be thrown if you try to call this
method twice.
Low-level method to generate a test result.
Report on the success or failure of a test:
$manager->ok(1, 'This is good');
$manager->ok(0, 'This is bad');
Test if the first two arguments are equal.
$manager->is($this, $that, "This and that are equal");
Test if the first two arguments are not equal.
$manager->isnt($this, $that, "This and that are equal");
Test if the first argument is matched by the regex passed as the second
argument.
$manager->like($this, qr/like that/i, "This and that are alike");
Test if the first argument is not matched by the regex passed as the second
argument.
$manager->unlike($this, qr/like that/i, "This and that are unalike");
Pass a test.
$manager->pass('Module Loaded');
Fail a test.
$manager->fail('Stonehenge crushed by a dwarf');
Skip a single test.
$manager->skip("We don't have that piece of scenery any more");
Skip a number of tests.
$manager->skip_some(11, "We don't have that piece of scenery any more");
Skip any remaining tests.
$manager->skip_rest("We don't have that piece of scenery any more");
Skip all tests. This should be called instead of plan()
$manager->skip_all("We don't have that piece of scenery any more");
Method to enable or disable colour mode.
This method is called automatically when the
"Badger::Test::Manager" object is destroyed.
It flushes any pending tests, performs any final sanity checks and prints a
summary if requested.
This methods flushes any cached test results. You don't need to worry about it.
This method generates a final summary of the tests
Used to generate the test messages displayed via the Badger::Base
messages() method. The message formats are defined in the
$MESSAGES package variable.
Use to generate a name for a test if one isn't explicitly provided.
This method is call when a test find a result that doesn't match the expected
value. If "Algorithm::Diff" is installed on
your machine, it will generate a message showing how the output and expected
values differ.
Otherwise it will generate a regular message reporting the
mismatch.
Andy Wardley <http://wardley.org/>
Copyright (C) 1996-2009 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |