NAME

Fennec::DeveloperManual::Collectors - Writing Custom Collectors

OVERVIEW

Fennec runs tests in parallel. All results must be sent from the child processes to the parent process. That is the collectors job. When output is generated it is sent to the collectors write() method. In the parent process the cull() method is run at an interval to obtain these written outputs.

Fennec::Output provides serialize and deserialize methods for your use. Output's reference a lot of datastructures when they are created, many of these references are not needed by the handlers. It is better to use the provided serialization methods than rolling your own.

Fennec::Collector::File is the default collector which fennec uses. It works by writing all outputs as files in a temp directory created prior to forking. Its cull() method reads and unlinks these files.

The collector stage can also be used to do other things, for example you could filter out some results, transform outputs of one type into another, etc. The most interesting collector level hack is Fennec::Collector::Interceptor which is used by Fennec::Assert::Interceptor to intercept output instead of sending it to the parent. Using Interceptor you can test the output produced by asserts.

SYNOPSIS

package Fennec::Collector::MyCollector;
use strict;
use warnings;

use base 'Fennec::Collector';

sub write {
    my $self = shift;
    my ( $output ) = @_;
    my $serialized = $output->serialize;

    # Put the output somewhere that it can be found by another process.
    ...;
}

sub cull {
    my $self = shift;

    # Get all the outputs written by other processes.
    my @serialized = ...;

    return map { Fennec::Output->deserialize( $_ )}
        @serialized;
}

1;

METHODS

You must override these methods.

$obj->write( $output )

Send an output to the parent process

@outputs = $obj->cull()

Return all the outputs sent to the parent form children.

USER DOCUMENTATION

User documentation is for those who wish to use Fennec to write simple tests, or manage a test suite for a project.

Fennec::UserManual

DEVELOPER DOCUMENTATION

Developer documentation is for those who wish to extend Fennec, or contribute to overall Fennec development.

Fennec::DeveloperManual

API DOCUMENTATION

API Documentation covers object internals. See the POD within each individual module.

AUTHORS

Chad Granum exodist7@gmail.com

COPYRIGHT

Copyright (C) 2010 Chad Granum

Fennec is free software; Standard perl licence.

Fennec is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.