15759b3d2Safresh1package Test2; 25759b3d2Safresh1use strict; 35759b3d2Safresh1use warnings; 45759b3d2Safresh1 5*5486feefSafresh1our $VERSION = '1.302199'; 65759b3d2Safresh1 75759b3d2Safresh1 85759b3d2Safresh11; 95759b3d2Safresh1 105759b3d2Safresh1__END__ 115759b3d2Safresh1 125759b3d2Safresh1=pod 135759b3d2Safresh1 145759b3d2Safresh1=encoding UTF-8 155759b3d2Safresh1 165759b3d2Safresh1=head1 NAME 175759b3d2Safresh1 185759b3d2Safresh1Test2 - Framework for writing test tools that all work together. 195759b3d2Safresh1 205759b3d2Safresh1=head1 DESCRIPTION 215759b3d2Safresh1 225759b3d2Safresh1Test2 is a new testing framework produced by forking L<Test::Builder>, 235759b3d2Safresh1completely refactoring it, adding many new features and capabilities. 245759b3d2Safresh1 255759b3d2Safresh1=head2 WHAT IS NEW? 265759b3d2Safresh1 275759b3d2Safresh1=over 4 285759b3d2Safresh1 295759b3d2Safresh1=item Easier to test new testing tools. 305759b3d2Safresh1 315759b3d2Safresh1From the beginning Test2 was built with introspection capabilities. With 325759b3d2Safresh1Test::Builder it was difficult at best to capture test tool output for 335759b3d2Safresh1verification. Test2 Makes it easy with C<Test2::API::intercept()>. 345759b3d2Safresh1 355759b3d2Safresh1=item Better diagnostics capabilities. 365759b3d2Safresh1 375759b3d2Safresh1Test2 uses an L<Test2::API::Context> object to track filename, line number, and 385759b3d2Safresh1tool details. This object greatly simplifies tracking for where errors should 395759b3d2Safresh1be reported. 405759b3d2Safresh1 415759b3d2Safresh1=item Event driven. 425759b3d2Safresh1 435759b3d2Safresh1Test2 based tools produce events which get passed through a processing system 445759b3d2Safresh1before being output by a formatter. This event system allows for rich plugin 455759b3d2Safresh1and extension support. 465759b3d2Safresh1 475759b3d2Safresh1=item More complete API. 485759b3d2Safresh1 495759b3d2Safresh1Test::Builder only provided a handful of methods for generating lines of TAP. 505759b3d2Safresh1Test2 took inventory of everything people were doing with Test::Builder that 515759b3d2Safresh1required hacking it up. Test2 made public API functions for nearly all the 525759b3d2Safresh1desired functionality people didn't previously have. 535759b3d2Safresh1 545759b3d2Safresh1=item Support for output other than TAP. 555759b3d2Safresh1 565759b3d2Safresh1Test::Builder assumed everything would end up as TAP. Test2 makes no such 575759b3d2Safresh1assumption. Test2 provides ways for you to specify alternative and custom 585759b3d2Safresh1formatters. 595759b3d2Safresh1 605759b3d2Safresh1=item Subtest implementation is more sane. 615759b3d2Safresh1 625759b3d2Safresh1The Test::Builder implementation of subtests was certifiably insane. Test2 uses 635759b3d2Safresh1a stacked event hub system that greatly improves how subtests are implemented. 645759b3d2Safresh1 655759b3d2Safresh1=item Support for threading/forking. 665759b3d2Safresh1 675759b3d2Safresh1Test2 support for forking and threading can be turned on using L<Test2::IPC>. 685759b3d2Safresh1Once turned on threading and forking operate sanely and work as one would 695759b3d2Safresh1expect. 705759b3d2Safresh1 715759b3d2Safresh1=back 725759b3d2Safresh1 735759b3d2Safresh1=head1 GETTING STARTED 745759b3d2Safresh1 755759b3d2Safresh1If you are interested in writing tests using new tools then you should look at 765759b3d2Safresh1L<Test2::Suite>. L<Test2::Suite> is a separate cpan distribution that contains 775759b3d2Safresh1many tools implemented on Test2. 785759b3d2Safresh1 795759b3d2Safresh1If you are interested in writing new tools you should take a look at 805759b3d2Safresh1L<Test2::API> first. 815759b3d2Safresh1 825759b3d2Safresh1=head1 NAMESPACE LAYOUT 835759b3d2Safresh1 845759b3d2Safresh1This describes the namespace layout for the Test2 ecosystem. Not all the 855759b3d2Safresh1namespaces listed here are part of the Test2 distribution, some are implemented 865759b3d2Safresh1in L<Test2::Suite>. 875759b3d2Safresh1 885759b3d2Safresh1=head2 Test2::Tools:: 895759b3d2Safresh1 905759b3d2Safresh1This namespace is for sets of tools. Modules in this namespace should export 915759b3d2Safresh1tools like C<ok()> and C<is()>. Most things written for Test2 should go here. 925759b3d2Safresh1Modules in this namespace B<MUST NOT> export subs from other tools. See the 935759b3d2Safresh1L</Test2::Bundle::> namespace if you want to do that. 945759b3d2Safresh1 955759b3d2Safresh1=head2 Test2::Plugin:: 965759b3d2Safresh1 975759b3d2Safresh1This namespace is for plugins. Plugins are modules that change or enhance the 985759b3d2Safresh1behavior of Test2. An example of a plugin is a module that sets the encoding to 995759b3d2Safresh1utf8 globally. Another example is a module that causes a bail-out event after 1005759b3d2Safresh1the first test failure. 1015759b3d2Safresh1 1025759b3d2Safresh1=head2 Test2::Bundle:: 1035759b3d2Safresh1 1045759b3d2Safresh1This namespace is for bundles of tools and plugins. Loading one of these may 1055759b3d2Safresh1load multiple tools and plugins. Modules in this namespace should not implement 1065759b3d2Safresh1tools directly. In general modules in this namespace should load tools and 1075759b3d2Safresh1plugins, then re-export things into the consumers namespace. 1085759b3d2Safresh1 1095759b3d2Safresh1=head2 Test2::Require:: 1105759b3d2Safresh1 1115759b3d2Safresh1This namespace is for modules that cause a test to be skipped when conditions 1125759b3d2Safresh1do not allow it to run. Examples would be modules that skip the test on older 1135759b3d2Safresh1perls, or when non-essential modules have not been installed. 1145759b3d2Safresh1 1155759b3d2Safresh1=head2 Test2::Formatter:: 1165759b3d2Safresh1 1175759b3d2Safresh1Formatters live under this namespace. L<Test2::Formatter::TAP> is the only 1185759b3d2Safresh1formatter currently. It is acceptable for third party distributions to create 1195759b3d2Safresh1new formatters under this namespace. 1205759b3d2Safresh1 1215759b3d2Safresh1=head2 Test2::Event:: 1225759b3d2Safresh1 1235759b3d2Safresh1Events live under this namespace. It is considered acceptable for third party 1245759b3d2Safresh1distributions to add new event types in this namespace. 1255759b3d2Safresh1 1265759b3d2Safresh1=head2 Test2::Hub:: 1275759b3d2Safresh1 1285759b3d2Safresh1Hub subclasses (and some hub utility objects) live under this namespace. It is 1295759b3d2Safresh1perfectly reasonable for third party distributions to add new hub subclasses in 1305759b3d2Safresh1this namespace. 1315759b3d2Safresh1 1325759b3d2Safresh1=head2 Test2::IPC:: 1335759b3d2Safresh1 1345759b3d2Safresh1The IPC subsystem lives in this namespace. There are not many good reasons to 1355759b3d2Safresh1add anything to this namespace, with exception of IPC drivers. 1365759b3d2Safresh1 1375759b3d2Safresh1=head3 Test2::IPC::Driver:: 1385759b3d2Safresh1 1395759b3d2Safresh1IPC drivers live in this namespace. It is fine to create new IPC drivers and to 1405759b3d2Safresh1put them in this namespace. 1415759b3d2Safresh1 1425759b3d2Safresh1=head2 Test2::Util:: 1435759b3d2Safresh1 1445759b3d2Safresh1This namespace is for general utilities used by testing tools. Please be 1455759b3d2Safresh1considerate when adding new modules to this namespace. 1465759b3d2Safresh1 1475759b3d2Safresh1=head2 Test2::API:: 1485759b3d2Safresh1 1495759b3d2Safresh1This is for Test2 API and related packages. 1505759b3d2Safresh1 1515759b3d2Safresh1=head2 Test2:: 1525759b3d2Safresh1 1535759b3d2Safresh1The Test2:: namespace is intended for extensions and frameworks. Tools, 1545759b3d2Safresh1Plugins, etc should not go directly into this namespace. However extensions 1555759b3d2Safresh1that are used to build tools and plugins may go here. 1565759b3d2Safresh1 1575759b3d2Safresh1In short: If the module exports anything that should be run directly by a test 1585759b3d2Safresh1script it should probably NOT go directly into C<Test2::XXX>. 1595759b3d2Safresh1 1605759b3d2Safresh1=head1 SEE ALSO 1615759b3d2Safresh1 1625759b3d2Safresh1L<Test2::API> - Primary API functions. 1635759b3d2Safresh1 1645759b3d2Safresh1L<Test2::API::Context> - Detailed documentation of the context object. 1655759b3d2Safresh1 1665759b3d2Safresh1L<Test2::IPC> - The IPC system used for threading/fork support. 1675759b3d2Safresh1 1685759b3d2Safresh1L<Test2::Formatter> - Formatters such as TAP live here. 1695759b3d2Safresh1 1705759b3d2Safresh1L<Test2::Event> - Events live in this namespace. 1715759b3d2Safresh1 1725759b3d2Safresh1L<Test2::Hub> - All events eventually funnel through a hub. Custom hubs are how 1735759b3d2Safresh1C<intercept()> and C<run_subtest()> are implemented. 1745759b3d2Safresh1 1755759b3d2Safresh1=head1 CONTACTING US 1765759b3d2Safresh1 1775759b3d2Safresh1Many Test2 developers and users lurk on L<irc://irc.perl.org/#perl-qa> and 1785759b3d2Safresh1L<irc://irc.perl.org/#toolchain>. We also have a slack team that can be joined 1795759b3d2Safresh1by anyone with an C<@cpan.org> email address L<https://perl-test2.slack.com/> 1805759b3d2Safresh1If you do not have an C<@cpan.org> email you can ask for a slack invite by 1815759b3d2Safresh1emailing Chad Granum E<lt>exodist@cpan.orgE<gt>. 1825759b3d2Safresh1 1835759b3d2Safresh1=head1 SOURCE 1845759b3d2Safresh1 1855759b3d2Safresh1The source code repository for Test2 can be found at 186*5486feefSafresh1L<https://github.com/Test-More/test-more/>. 1875759b3d2Safresh1 1885759b3d2Safresh1=head1 MAINTAINERS 1895759b3d2Safresh1 1905759b3d2Safresh1=over 4 1915759b3d2Safresh1 1925759b3d2Safresh1=item Chad Granum E<lt>exodist@cpan.orgE<gt> 1935759b3d2Safresh1 1945759b3d2Safresh1=back 1955759b3d2Safresh1 1965759b3d2Safresh1=head1 AUTHORS 1975759b3d2Safresh1 1985759b3d2Safresh1=over 4 1995759b3d2Safresh1 2005759b3d2Safresh1=item Chad Granum E<lt>exodist@cpan.orgE<gt> 2015759b3d2Safresh1 2025759b3d2Safresh1=back 2035759b3d2Safresh1 2045759b3d2Safresh1=head1 COPYRIGHT 2055759b3d2Safresh1 206256a93a4Safresh1Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. 2075759b3d2Safresh1 2085759b3d2Safresh1This program is free software; you can redistribute it and/or 2095759b3d2Safresh1modify it under the same terms as Perl itself. 2105759b3d2Safresh1 211*5486feefSafresh1See L<https://dev.perl.org/licenses/> 2125759b3d2Safresh1 2135759b3d2Safresh1=cut 214