1Fennec::Manual::CustomFUesnenrecC(o3n)tributed Perl DocuFmeennnteact:i:oMnanual::CustomFennec(3)
2
3
4

NAME

6       Fennec::Manual::CustomFennec - Customizing Fennec for you project.
7

DESCRIPTION

9       Fennec automatically loads several utilities for you. In addition it
10       assumes you want to use Test::Builder. Subclassing Fennec will let you
11       specify exactly what utilities you want, and what collector to use.
12       This way you can use your subclass in each test file instead of copying
13       "use Fennec ( YOUR CONFIG OPTIONS )" into each file.
14

FENNEC SUBCLASS

16       You can subclass Fennec and override the defaults sub to your
17       specification.  The defaults sub should return a list of Fennec import
18       argument key-pairs.
19
20       My/Fennec.pm
21           use strict;
22           use warnings;
23
24           use base 'Fennec';
25
26           sub defaults {
27               my $class = shift;
28               my %params = $class->SUPER::defaults;
29
30               # Add a new autoloading utility with import arguments.
31               push @{ $params->{utils} } => 'My::Util';
32               $params->{'My::Util'} = [ 'util' => 'args' ];
33
34               # Default number of concurrent procs for the test to use.
35               $params->{parallel} = 3;
36
37               return %params;
38           }
39
40           sub after_import {
41               my $class = shift;
42               my ($info) = @_;
43               # $info is a hashref with the importer, runner, and importer meta
44               # object, and some other fun things.
45
46               # Example of adding cases to any Fennec test that uses this subclass:
47               # The first arg to add case should be an array matching the return of
48               # caller. The idea is to give us the start and end line, as well as
49               # file name where the case is defined. normally the exports from
50               # Test::Workflow provide that for you, but at this low-level we need to
51               # provide it ourselfs. Since we define the subs here, we give current
52               # line/file. Use the importer for package name.
53               $info->{layer}->add_case([$info->{importer}, __FILE__, __LINE__], case_a => sub { $main::CASE_A = 1 });
54               $info->{layer}->add_case([$info->{importer}, __FILE__, __LINE__], case_b => sub { $main::CASE_B = 1 });
55           }
56
57           1;
58

CUSTOM COLLECTOR

60       The collector is responsible for 2 jobs: 1) In the parent process it is
61       responsible for gathering all test results from the child processes.
62       2) In the child processes it is responsible for sending results to the
63       parent process.
64
65       If TAP is not your thing, or you want to use Fennec with existing tests
66       that do not use Test::Builder, you can create a custom collector to
67       work for you.
68
69       Documentation for a custom Collector can be found in the
70       Fennec::Collector POD.
71

AUTHORS

73       Chad Granum exodist7@gmail.com
74
76       Copyright (C) 2013 Chad Granum
77
78       Fennec is free software; Standard perl license (GPL and Artistic).
79
80       Fennec is distributed in the hope that it will be useful, but WITHOUT
81       ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
82       FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
83
84
85
86perl v5.36.0                      2022-07-22   Fennec::Manual::CustomFennec(3)
Impressum