The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Zonemaster::Engine::Test - Module implementing methods to find, load and execute all Test modules

SYNOPSIS

    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

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.

INTERNAL METHODS

_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).

METHODS

modules()
    my @modules_array = modules();

Returns a list of strings containing the names of all available Test modules, with the exception of Zonemaster::Engine::Test::Basic (since that one is a bit special), 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.

This method always starts with the execution of the Basic Test module. If the Basic tests fail to indicate 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), the testing suite is aborted. See "can_continue()" in Zonemaster::Engine::Test::Basic for more details. Otherwise, other 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.

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.