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 the Test2::V1 bundle (which is an exception to the namespace rule as it does not live under Test2::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 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