Test2::Manual::Testing - Hub for documentation about writing tests with Test2.
This document outlines all the tutorials and POD that cover writing tests. This
section does not cover any Test2 internals, nor does it cover how to write new
tools, for that see the Test2::Manual::Tooling manpage.
When writing tests there are a couple namespaces to focus on:
- Test2::Tools::*
-
This is where toolsets can be found. 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.
- Test2::Plugins::*
-
This is where plugins live. Plugins should not export anything, but instead
will introduce or alter behaviors for Test2 in general. These 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 the the Test2::V0 manpage bundle (which
is an exception to the namespace rule as it does not live under
Test2::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 require external libraries that may not always be available.
When you use Test2, specifically things included in the Test2::Suite manpage you need
to list them in your modules test dependencies. It is important to note that
you should list the tools/plugins/bundles you need, you should not simply list
the Test2::Suite manpage as your dependency. the Test2::Suite manpage 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
the Test2::Suite manpage into their own distributions.
One goal of the Test2::Suite manpage is to avoid breaking backwards compatibility.
Another goal is to always improve by replacing bad designs with better ones.
When necessary the Test2::Suite manpage 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.
So for example, if you use the Test2::V0 manpage, and the Dist::Zilla manpage 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 the Test2::V0 manpage might not always be part of the Test2::Suite manpage.
When writing new tests you should often check the Test2::Suite manpage to see what the
current recommended bundle is.
[Prereqs / TestRequires]
Test2::V0 = 0.000060
my %WriteMakefileArgs = (
...,
"TEST_REQUIRES" => {
"Test2::V0" => "0.000060"
},
...
);
test_requires 'Test2::V0' => '0.000060';
my $build = Module::Build->new(
...,
test_requires => {
"Test2::V0" => "0.000060",
},
...
);
the Test2::Manual::Testing::Introduction manpage is an introduction to writing tests
using the Test2 tools.
the Test2::Manual::Testing::Migrating manpage Is a tutorial for converting old tests
that use the Test::Builder manpage or the Test::More manpage to the newer Test2 way of doing
things.
the Test2::Manual::Testing::Planning manpage is a tutorial on the many ways to set a
plan.
the Test2::Manual::Testing::Todo manpage is a tutorial for markings tests as TODO.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
COMING SOON.
the Test2::Manual manpage - Primary index of the manual.
The source code repository for Test2-Manual can be found at
https://github.com/Test-More/Test2-Suite/.
- Chad Granum
-
- Chad Granum <exodist@cpan.org>Chad Granum
-
Copyright 2018 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/
|