Fergal Daly > Test-Tester-0.04 > Test::Tester

Download:
Test-Tester-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  1
View Bugs
Report a bug
Module Version: 0.04   Source   Latest Release: Test-Tester-0.107

NAME ^

Test::Tester - Help testing test modules built with Test::Builder

SYNOPSIS ^

  use Test::Tester qw( tests => 5);

  use Test::MyStyle;

  Test::MyStyle::set_builder(Test::Tester->capture);

  check_test(
    sub {
      is_mystyle_eq("this", "that", "not eq");
    },
    {
      name => "not eq",
      ok => 0,
      diag => "Expected: 'this'\nGot: 'that'",
    }
  );

DESCRIPTION ^

If you have written a test module based on Test::Builder then Test::Tester makes it easier for you to test your tests. It provides an object from Test::Tester::Capture which inherits from Test::Builder but overrides the the methods your test module will call so that it can prevent test output and also capture test results and diagnostics for examination.

HOW TO USE ^

Make your module use the Test::Tester::Capture object instead of the Test::Builder one. How to do this depends on your module but assuming that your module holds the Test::Builder object in $Test and that all your test routines access it through $Test then providing a function something like this

  sub set_builder
  {
    $Test = shift;
  }

should allow your test scripts to do

  Test::YourModule::set_builder(Test::Tester->capture);

and after that any tests inside your module will captured.