Skip to content

Commit

Permalink
Rework of (new) unit testing framework: update after review
Browse files Browse the repository at this point in the history
Update documentation
Add links to the test zone specifications
  • Loading branch information
tgreenx committed Nov 16, 2023
1 parent ef82b8a commit e616dfe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions t/Test-dnssec16.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BEGIN {
}

###########
# dnssec16
# dnssec16 - https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/test-zones/DNSSEC-TP/dnssec16.md
my $test_module = q{DNSSEC};
my $test_case = 'dnssec16';

Expand All @@ -27,7 +27,8 @@ Zonemaster::Engine::Recursor->add_fake_addresses( '.',
);

# Test zone scenarios
# Format: { SCENARIO_NAME => [ zone_name, [ MANDATORY_MESSAGE_TAGS ], [ FORBIDDEN_MESSAGE_TAGS ], testable ] }
# - Documentation: L<TestUtil/perform_testcase_testing()>
# - Format: { SCENARIO_NAME => [ zone_name, [ MANDATORY_MESSAGE_TAGS ], [ FORBIDDEN_MESSAGE_TAGS ], testable ] }
my %subtests = (
'CDS-INVALID-RRSIG' => [
q(cds-invalid-rrsig.dnssec16.xa),
Expand Down
5 changes: 3 additions & 2 deletions t/Test-zone09-1.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BEGIN {
}

###########
# zone09
# zone09 - https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/test-zones/Zone-TP/zone09.md
my $test_module = q{Zone};
my $test_case = 'zone09';

Expand All @@ -27,7 +27,8 @@ Zonemaster::Engine::Recursor->add_fake_addresses( '.',
);

# Test zone scenarios
# Format: { SCENARIO_NAME => [ zone_name, [ MANDATORY_MESSAGE_TAGS ], [ FORBIDDEN_MESSAGE_TAGS ], testable ] }
# - Documentation: L<TestUtil/perform_testcase_testing()>
# - Format: { SCENARIO_NAME => [ zone_name, [ MANDATORY_MESSAGE_TAGS ], [ FORBIDDEN_MESSAGE_TAGS ], testable ] }
my %subtests = (
'ROOT-EMAIL-DOMAIN' => [
q(.),
Expand Down
5 changes: 3 additions & 2 deletions t/Test-zone09.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BEGIN {
}

###########
# zone09
# zone09 - https://github.com/zonemaster/zonemaster/blob/master/docs/public/specifications/test-zones/Zone-TP/zone09.md
my $test_module = q{Zone};
my $test_case = 'zone09';

Expand All @@ -27,7 +27,8 @@ Zonemaster::Engine::Recursor->add_fake_addresses( '.',
);

# Test zone scenarios
# Format: { SCENARIO_NAME => [ zone_name, [ MANDATORY_MESSAGE_TAGS ], [ FORBIDDEN_MESSAGE_TAGS ], testable ] }
# - Documentation: L<TestUtil/perform_testcase_testing()>
# - Format: { SCENARIO_NAME => [ zone_name, [ MANDATORY_MESSAGE_TAGS ], [ FORBIDDEN_MESSAGE_TAGS ], testable ] }
my %subtests = (
'NO-RESPONSE-MX-QUERY' => [
q(no-response-mx-query.zone09.xa),
Expand Down
10 changes: 6 additions & 4 deletions t/TestUtil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ unknown to the include path @INC, it can be including using the following code:
perform_testcase_testing( $test_case, $test_module, %subtests );
This method loads unit test data (test case name, test module name and test scenarios), runs the specified test case, and checks for the presence
(or absence) of specific message tags for each specified test scenario.
This method loads unit test data (test case name, test module name and test scenarios) and, after some data checks
and if the test scenario is testable, it runs the specified test case and checks for the presence (or absence) of
specific message tags for each specified test scenario.
Takes a string (test case name), a string (test module name) and a hash - the keys of which are: C<zone>, C<mandatory>, C<forbidden>, C<testable>,
and their corresponding values are a string (zone name), an array of strings (message tags), an array of strings (message tags) and a boolean.
Takes a string (test case name), a string (test module name) and a hash - the keys of which are scenario names
(in all uppercase), and their corresponding values are an array of: a string (zone name), an array of strings
(mandatory message tags), an array of strings (forbidden message tags) and a boolean (testable).
=back
Expand Down

0 comments on commit e616dfe

Please sign in to comment.