Test2::...Testing(3)
π NAME π
Test2::Manual::Testing β hub for documentation about writing tests with Test2. π
πΈ DESCRIPTION πΈ
This doc is literally your guide to all the tutorials and POD that cover writing tests. It does not cover any Test2 internals, and it does not cover how to write new tools β for that, go see Test2::Manual::Tooling, bestie. π«Ά
πΊοΈ NAMESPACE MAP πΊοΈ
When you're writing tests, there are a couple namespaces to focus on:
Test2::Tools::*β this is where toolsets live. A toolset exports functions that help you make assertions about your code. Toolsets only export functions β they should never have extra/global effects. periodt.Test2::Plugins::*β this is where plugins live. Plugins should not export anything; instead, they introduce or alter behaviors for Test2 in general. Those behaviors may be lexically scoped, or they may be global.Test2::Bundle::*β bundles combine toolsets and plugins together to reduce your boilerplate. First-time test writers are encouraged to start with theTest2::V0bundle (which is an exception to the namespace rule because it does not live underTest2::Bundle::). If you find yourself loading several plugins and toolsets over and over again, 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 note: you should list the tools/plugins/bundles you need, and you should not simply list Test2::Suite as your dependency. 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.
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. no cap.
So for example, if you use Test2::V0 and Dist::Zilla, you should have this in your config:
[Prereqs / TestRequires]
Test2::V0 = 0.000060
You SHOULD NOT do this:
[Prereqs / TestRequires]
Test2::Suite = 0.000060
Because Test2::V0 might not always be part of Test2::Suite. π
When writing new tests, you should often check Test2::Suite to see what the current recommended bundle is.
Dist::Zilla
[Prereqs / TestRequires]
Test2::V0 = 0.000060
ExtUtils::MakeMaker
my %WriteMakefileArgs = (
...,
"TEST_REQUIRES" => {
"Test2::V0" => "0.000060"
},
...
);
Module::Install
test_requires 'Test2::V0' => '0.000060';
Module::Build
my $build = Module::Build->new(
...,
test_requires => {
"Test2::V0" => "0.000060",
},
...
);
π§ TUTORIALS π§
πΌ SIMPLE/INTRODUCTION TUTORIAL πΌ
Test2::Manual::Testing::Introduction is an introduction to writing tests using the Test2 tools. iconic starter energy. β¨
π¦ 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 time. π
π ADVANCED PLANNING π
Test2::Manual::Testing::Planning is a tutorial on the many ways to set a plan.
π TODO TESTS π
Test2::Manual::Testing::Todo is a tutorial for marking tests as TODO.
π 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. iykyk. π
π 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.
See http://dev.perl.org/licenses/
okay that's the whole page, bestie β from the Test2::...Testing(3) manual, shipped with perl v5.42.0, dated 2025-07-28. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Test-Simple 1.302214-bp160.1.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms