VERSION

Version 0.34

DESCRIPTION

Plans isolation strategy for each method under test, based on side effect analysis and dependency metadata from the schema. Determines whether each method needs a shared fixture, a fresh object per test, or a fully isolated block, and records any environmental dependencies that need mocking.

new

Construct a new Isolation planner.

my $planner = App::Test::Generator::Planner::Isolation->new;

Arguments

None.

Returns

A blessed hashref.

API specification

input

{}

output

{
    type => OBJECT,
    isa  => 'App::Test::Generator::Planner::Isolation',
}

plan

Produce an isolation plan for each method based on its side effect analysis and dependency metadata.

my $planner   = App::Test::Generator::Planner::Isolation->new;
my $isolation = $planner->plan($schema, $strategy);

for my $method (keys %{$isolation}) {
    printf "%s fixture: %s\n", $method, $isolation->{$method}{fixture};
}

Arguments

  • $schema

    A hashref of method schemas, each optionally containing a _analysis key with side_effects and dependencies sub-keys.

  • $strategy

    A hashref whose keys are the method names to plan isolation for. Values are not used directly — the hashref is used only for its keys.

Returns

A hashref mapping method names to isolation plan hashrefs. Each plan has a fixture key and optionally env, filesystem, time, and network keys where relevant dependencies were detected.

API specification

input

{
    self     => { type => OBJECT,  isa  => 'App::Test::Generator::Planner::Isolation' },
    schema   => { type => HASHREF },
    strategy => { type => HASHREF },
}

output

{
    type => HASHREF,
    keys => {
        '*' => {
            type => HASHREF,
            keys => {
                fixture    => { type => SCALAR },
                env        => { type => HASHREF,  optional => 1 },
                filesystem => { type => HASHREF,  optional => 1 },
                time       => { type => SCALAR,   optional => 1 },
                network    => { type => SCALAR,   optional => 1 },
            },
        },
    },
}

1 POD Error

The following errors were encountered while parsing the POD:

Around line 90:

Non-ASCII character seen before =encoding in '—'. Assuming UTF-8