Zonemaster::Engine::Test - Module implementing methods to find,
load and execute all Test modules
my @results = Zonemaster::Engine::Test->run_all_for($zone);
my @results = Zonemaster::Engine::Test->run_module('DNSSEC', $zone);
my @results = Zonemaster::Engine::Test->run_one('DNSSEC', 'dnssec01', $zone);
Test modules are defined as modules with names starting with
"Zonemaster::Engine::Test::". They are
expected to provide at least the following class methods:
- all()
- This will be given a Zonemaster::Engine::Zone object as its only argument,
and, after running the Test Cases for that Test module, is expected to
return a list of Zonemaster::Engine::Logger::Entry objects. This is the
entry point used by the "run_all_for()" and
"run_module()" methods of this class.
- version()
- This must return the version of the Test module.
- metadata()
- This must return a reference to a hash, the keys of which are the names of
all Test Cases in the module, and the corresponding values are references
to an array containing all the message tags that the Test Case can use in
log entries.
- tag_descriptions()
- This must return a reference to a hash, the keys of which are the message
tags and the corresponding values are strings (message IDs) corresponding
to user-friendly English translations of those message tags. Keep in mind
that the message ids will be used as keys to look up translations into
other languages, so think twice before editing them.
- _log_versions()
-
_log_versions();
Adds logging messages regarding the current version of some
modules, specifically for Zonemaster::Engine and other dependency
modules (e.g. Zonemaster::LDNS).
- modules()
-
my @modules_array = modules();
Returns a list of strings containing the names of all
available Test modules, based on the content of the
share/modules.txt file.
- run_all_for()
-
my @logentry_array = run_all_for( $zone );
Runs the default set of tests of all Test modules found for
the given zone.
Test modules are looked up and loaded from the
share/modules.txt file, and executed in the order in which they
appear in the file. The default set of tests (Test Cases) is specified
in the "all()" method of each Test module. They can be
individually disabled by the profile.
A test module may implement a
can_continue() method to indicate lack of an
extremely minimal level of function for the zone (e.g., it must have a
parent domain, and it must have at least one functional name server). If
lack of such minimal function is indicated, the testing harness is
aborted. See "can_continue()" in
Zonemaster::Engine::Test::Basic for an example.
Takes a Zonemaster::Engine::Zone object.
Returns a list of Zonemaster::Engine::Logger::Entry
objects.
- run_module()
-
my @logentry_array = run_module( $module, $zone );
Runs the default set of tests of the given Test module for the
given zone.
The Test module must be in the list of actively loaded modules
(that is, a module defined in the share/modules.txt file). The
default set of tests (Test Cases) is specified in the
"all()" method of each Test module. They can be
individually disabled by the profile.
Takes a string (module name) and a Zonemaster::Engine::Zone
object.
Returns a list of Zonemaster::Engine::Logger::Entry
objects.
- run_one()
-
my @logentry_array = run_one( $module, $test_case, $zone );
Runs the given Test Case of the given Test module for the
given zone.
The Test module must be in the list of actively loaded modules
(that is, a module defined in the share/modules.txt file), and
the Test Case must be listed both in the metadata of the Test module
exports and in the profile.
Takes a string (module name), a string (test case name) and an
array of Zonemaster::Engine::Zone objects.
Returns a list of Zonemaster::Engine::Logger::Entry
objects.