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

NAME

Zonemaster::Engine::Test - module 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);

TEST MODULES

Test modules are defined as modules with names starting with "Zonemaster::Engine::Test::". They are expected to provide at least four class methods, and optionally a fifth one.

all($zone)

all will be given a zone object as its only argument, and is epected 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.

version()

This must return the version of the test module.

metadata()

This must return a reference to a hash where the keys are the names of callable methods implementing tests, and the values are references to arrays with the tags of the messages the test methods can generate.

translation()

This must return a reference to a hash where the keys are all the message tags the test module can produce, and the corresponing keys are the english translations of those messages. The translation strings will be used as keys to look up translations into other languages, so think twice before editing them.

policy()

Optionally, a test module can implement this method, which if implemented should return a reference to a hash where the keys are all the message tags the module can produce and the correspondning values are their recommended default log levels.

CLASS METHODS

modules()

Returns a list with the names of all available test modules except Zonemaster::Engine::Test::Basic (since that one is a bit special).

run_all_for($zone)

Runs all (default) tests in all test modules found, and returns a list of the log entry objects they returned.

The order in which the test modules found will be executed is not defined, except that Zonemaster::Engine::Test::Basic is always executed first. If the Basic tests fail to indicate a very basic level of function (it must have a parent domain, and it must have at least one functional nameserver) for the zone, no further tests will be executed.

run_module($module, $zone)

Runs all default tests in the named module for the given zone.

run_one($module, $method, @arguments)

Run one particular test method in one particular module. The requested module must be in the list of active loaded modules (that is, not a module disabled by the current policy), and the method must be listed in the metadata the module exports. If those requirements are fulfilled, the method will be called with the provided arguments. No attempt is made to check that the provided arguments make sense for the particular method called. That is left entirely to the user.