Test2:...esting(3perl)
π Test2::...esting β the manual page (3perl), bestie edition π
okay so this is Test2:...esting(3perl), like, the hub page π
it's part of the Perl Programmers Reference Guide, and it's your lil map to writing tests with Test2. no cap.
π«Ά NAME π«Ά
Test2::Manual::Testing β the hub for all the documentation about writing tests with Test2, periodt.
β¨ DESCRIPTION β¨
This doc is literally the master list of every tutorial and every bit of POD that covers writing tests π
Heads up tho: it does not cover any Test2 internals, and it does not cover how to write new tools. for that, babe, you want Test2::Manual::Tooling. different page, different vibe π¦
πΊοΈ NAMESPACE MAP πΊοΈ
when you're writing tests there are a couple namespaces you should be looking at, and like, they each have a role:
Test2::Tools::*β this is where toolsets live π A toolset exports functions that help you make assertions about your code. Toolsets will only export functions, they should not ever have extra/global effects. respect the boundaries bestie.Test2::Plugins::*β this is where plugins live β¨ Plugins should not export anything, but instead they'll introduce or alter behaviors for Test2 in general. Those behaviors may be lexically scoped, or they may be global. iykyk.Test2::Bundle::*β bundles combine toolsets and plugins together so you don't have to write all that boilerplate yourself π First-time test writers are encouraged to start with theTest2::V1bundle (which is an exception to the namespace rule as it does not live underTest2::Bundle::). and if you catch yourself loading several plugins and toolsets over and over again?? that's your sign, you could benefit from writing your own bundle πTest2::Require::*β this namespace contains modules that will cause a test to skip if specific conditions are not met πΈ Use this if you have tests that only run on specific perl versions, or that require external libraries that may not always be available.
π¦ LISTING DEPENDENCIES π¦
When you use Test2 β specifically things included in Test2::Suite β you need to list them in your module's test dependencies. Important detail here: you should list the tools/plugins/bundles you need, you should not simply list Test2::Suite as your dependency. π¨
Why? Because Test2::Suite is a living distribution intended to represent the "current" best practices. As tools, plugins, and bundles evolve, old ones will become discouraged and potentially be moved from Test2::Suite into their own distributions. so like, it moves, it changes, it's alive π
One goal of Test2::Suite is to avoid breaking backwards compatibility. Another goal is to always improve by replacing bad designs with better ones. When necessary, Test2::Suite will break old modules out into separate dists and define new ones, typically with a new bundle. In short: if we feel the need to break something we will do so by creating a new bundle, and discouraging the old one, but we will not break the old one. safe. secure. cozy π§
so for example, if you use Test2::V1, and Dist::Zilla, you should have this in your config:
[Prereqs / TestRequires]
Test2::V1 = 0.000060
You SHOULD NOT do this:
[Prereqs / TestRequires]
Test2::Suite = 0.000060
Because Test2::V1 might not always be part of Test2::Suite. periodt. π
When writing new tests you should often check Test2::Suite to see what the current recommended bundle is. π
π Dist::Zilla
[Prereqs / TestRequires]
Test2::V1 = 0.000060
π ExtUtils::MakeMaker
my %WriteMakefileArgs = (
...,
"TEST_REQUIRES" => {
"Test2::V1" => "0.000060"
},
...
);
π Module::Install
test_requires 'Test2::V1' => '0.000060';
π Module::Build
my $build = Module::Build->new(
...,
test_requires => {
"Test2::V1" => "0.000060",
},
...
);
π TUTORIALS π
π± SIMPLE/INTRODUCTION TUTORIAL
Test2::Manual::Testing::Introduction is an introduction to writing tests using the Test2 tools. start here babe, it's giving beginner friendly π
π MIGRATING FROM TEST::BUILDER and TEST::MORE
Test2::Manual::Testing::Migrating Is a tutorial for converting old tests that use Test::Builder or Test::More to the newer Test2 way of doing things. glow-up tutorial fr fr β¨
π§ ADVANCED PLANNING
Test2::Manual::Testing::Planning is a tutorial on the many ways to set a plan. so many ways. iconic.
π TODO TESTS
Test2::Manual::Testing::Todo is a tutorial for markings tests as TODO. (yes, the original says "markings", we're keeping it, don't look at us π)
πͺ SUBTESTS
COMING SOON.
βοΈ COMPARISONS
COMING SOON.
βοΈ SIMPLE COMPARISONS
COMING SOON.
βοΈ ADVANCED COMPARISONS
COMING SOON.
π€ TESTING EXPORTERS
COMING SOON.
ποΈ TESTING CLASSES
COMING SOON.
πͺ€ TRAPPING
COMING SOON.
πͺ€ TRAPPING EXCEPTIONS
COMING SOON.
πͺ€ TRAPPING WARNINGS
COMING SOON.
β³ DEFERRED TESTING
COMING SOON.
π€ MANAGING ENCODINGS
COMING SOON.
π AUTO-ABORT ON FAILURE
COMING SOON.
π² CONTROLLING RANDOM BEHAVIOR
COMING SOON.
π WRITING YOUR OWN BUNDLE
COMING SOON.
π§° TOOLSET DOCUMENTATION π§°
COMING SOON.
π PLUGIN DOCUMENTATION π
COMING SOON.
π BUNDLE DOCUMENTATION π
COMING SOON.
π¦ REQUIRE DOCUMENTATION π¦
COMING SOON.
π SEE ALSO π
Test2::Manualβ Primary index of the manual. your home base bestie π
π SOURCE π
The source code repository for Test2-Manual can be found at https://github.com/Test-More/test-more/ π«Ά
π οΈ MAINTAINERS π οΈ
Chad Granum <exodist@cpan.org>
βοΈ AUTHORS βοΈ
Chad Granum <exodist@cpan.org>
Β©οΈ COPYRIGHT Β©οΈ
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, open source π
See http://dev.perl.org/licenses/
and that's the whole page!! πΈ this was Test2:...esting(3perl) from perl v5.44.0, dated 2026-10-17 β love that for us. go write some tests bestie, you're gonna ate πβ¨π¦
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms