Suite
NAME
Test::Declare::Suite
SYNOPSIS
use Test::Declare::Suite;
use Module::Under::Test;
class MyTest does Test::Declare::Suite {
method class { Module::Under::Test }
method method { 'some-method' }
method construct { \(some => 'value') }
method tests {
${
name => 'test 1',
args => \(3),
expected => {
return-value => ā¦,
},
},
ā¦
}
}
MyTest.new.run-me;
Test::Declare::Suite is a helper role which enables bundling of multiple tests that operate on the same callable, to reduce repetition.
When consuming the role, you must implement methods called class
,
method
and construct
(if appropriate) to use as defaults. Also
implement method tests() returns Array {...}
for the slimmed down test
scenarios, now varying only on arguments and expectations.
Individual test hashes can still provide any element of the call
hash to override the default.
Each class's tests should be executed by calling ClassName.new.run-me
.