++ed by:

96 PAUSE users
67 non-PAUSE users.

Chad Granum
and 1 contributors


Test::Builder - *DEPRECATED* Module for building testing libraries.


This module was previously the base module for almost any testing library. This module is now little more than a compatability wrapper around Test::Stream. If you are looking to write or update a testing library you should look at Test::Stream::Toolset.



The variable that holds the Test::Builder singleton.


In the past this variable was used to track stack depth so that Test::Builder could report the correct line number. If you use Test::Builder this will still work, but in new code it is better to use the Test::Stream::Context module.




Returns the singleton stored in $Test::Builder::Test.

Test::Builder->create(use_shared => 1)

Returns a new instance of Test::Builder. It is important to note that this instance will not use the shared Test::Stream object unless you pass in the use_shared => 1 argument.



Helper method for Test::Builder to get a Test::Stream::Context object.


Get the subtest depth


These all check on todo state and value



These let you figure out when/where the test is defined in the test file.


Start a subtest (Please do not use this)


Finish a subtest (Please do not use this)


Interface to Data::Dumper that dumps whatever you give it.


This used to tell you what package used Test::Builder, it never worked well. The previous bad and unpredictable behavior of this has largely been preserved, however nothing internal uses it in any meaningful way anymore.


Check if something is a filehandle


Get/Set $Test::Builder::Level. $Level is a package var, and most thigns localize it, so this method is pretty useless.


Check if something might be a regex.


Reset the builder object to a very basic and default state. You almost certainly do not need this unless you are writing a tool to test testing libraries. Even then you probably do not want this.


Start/end TODO state, there are better ways to do this now.


These simply interface into functionality of Test::Stream.


These get/set the IO handle used in the 'legacy' tap encoding.


Do not display Test::Stream::Event::Diag events.


Do not do some special magic at the end that tells you what went wrong with tests.


Do not display the plan


Turn numbers in TAP on and off.



Get all the events that occured on this object. Each event will be transformed into a hash that matches the legacy output of this method.


Set/Get expected number of tests


Check if there is a plan


List of pass/fail results.


See Test::Stream::Context, Test::Stream::Toolset, and Test::More::Tools. Calling the methods below is not advised.




Get the stream used by this builder (or the shared stream).


Name of the test


Parent if this is a child.


Many legacy testing modules monkeypatch ok(), plan(), and others. The abillity to monkeypatch these to effect all events of the specified type is now considered discouraged. For backwords compatability monkeypatching continues to work, however in the distant future it will be removed. Test::Stream upon which Test::Builder is now built, provides hooks and API's for doing everything that previously required monkeypatching.



The original Test::Tutorial. Uses comedy to introduce you to testing from scratch.


The Test::Tutorial::WritingTests tutorial takes a more technical approach. The idea behind this tutorial is to give you a technical introduction to testing that can easily be used as a reference. This is for people who say "Just tell me how to do it, and quickly!".


The Test::Tutorial::WritingTools tutorial is an introduction to writing testing tools that play nicely with other Test::Stream and Test::Builder based tools. This is what you should look at if you want to write Test::MyWidget.


The source code repository for Test::More can be found at http://github.com/Test-More/test-more/.


Chad Granum <exodist@cpan.org>


The following people have all contributed to the Test-More dist (sorted using VIM's sort function).

Chad Granum <exodist@cpan.org>
Fergal Daly <fergal@esatclear.ie>>
Mark Fowler <mark@twoshortplanks.com>
Michael G Schwern <schwern@pobox.com>


There has been a lot of code migration between modules, here are all the original copyrights together:


Copyright 2014 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html


Originally authored by Michael G Schwern <schwern@pobox.com> with much inspiration from Joshua Pritikin's Test module and lots of help from Barrie Slaymaker, Tony Bowden, blackstar.co.uk, chromatic, Fergal Daly and the perl-qa gang.

Idea by Tony Bowden and Paul Johnson, code by Michael G Schwern <schwern@pobox.com>, wardrobe by Calvin Klein.

Copyright 2001-2008 by Michael G Schwern <schwern@pobox.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html


To the extent possible under law, 唐鳳 has waived all copyright and related or neighboring rights to Test-use-ok.

This work is published from Taiwan.



This module is copyright 2005 Fergal Daly <fergal@esatclear.ie>, some parts are based on other people's work.

Under the same license as Perl itself

See http://www.perl.com/perl/misc/Artistic.html


Copyright Mark Fowler <mark@twoshortplanks.com> 2002, 2004.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.