Badger::Test::Manager
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- plan($tests)
- result($flag,@args)
- ok($flag, $name)
- is($this, $that, $name)
- isnt($this, $that, $name)
- like($text, qr/regex/, $name)
- unlike($text, qr/regex/, $name)
- pass($name)
- fail($name)
- skip($reason)
- skip_some($number,$reason)
- skip_rest(,$reason)
- skip_all($reason)
- colour($flag)
- color($flag)
- INTERNAL METHODS
- finish()
- flush()
- summary()
- test_msg()
- test_name()
- different($expect,$result)
- AUTHOR
- COPYRIGHT
- SEE ALSO
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.
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");
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");
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.
Used to generate the test messages displayed via the Badger::Base messages() method. The
message formats are defined in the $MESSAGES
package
variable.
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.