The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TAP::Runner - Running tests with options

VERSION

version 0.003

SYNOPSIS

    #!/usr/bin/perl
    use strict;
    use warnings;

    use TAP::Runner;
    use TAP::Formatter::HTML;

    TAP::Runner->new(
        {
            # harness_class => 'TAP::Harness::JUnit',
            # harness_formatter => TAP::Formatter::HTML->new,
            harness_args => {
                rules => {
                    par => [
                        { seq => qr/^Test alias 2.*$/  },
                        { seq => '*' },
                    ],
                },
                jobs  => 4,
            },
            tests => [
                {
                    file    => 't/examples/test.t',
                    alias   => 'Test alias',
                    args    => [
                        '--option', 'option_value_1'
                    ],
                    options => [
                        {
                            name   => '--server',
                            values => [
                                'first.local',
                                'second.local',
                            ],
                            multiple => 0,
                        },
                        {
                            name   => '--browser',
                            values => [
                                'firefox',
                                'chrome',
                            ],
                            multiple => 1,
                        },
                    ],
                },
                {
                    file    => 't/examples/test2.t',
                    alias   => 'Test alias 2',
                    args    => [
                        '--option', 'option_value_1'
                    ],
                },
                {
                    file    => 't/examples/test2.t',
                    alias   => 'Test alias 22',
                    args    => [
                        '--option', 'option_value_2'
                    ],
                },
            ],
        }
    )->run;

DESCRIPTION

This module allows to run tests more flexible. Allows to use TAP::Harness, not just for unit tests.

METHODS

new

Create a new TAP::Runner object. tests atribute required

    # Tests to run with runner
    my @tests  = ( { file => 't/test.t' } );

    # Tests auto coerce to L<TAP::Runner::Test>
    my $runner = TAP::Runner->new(
        tests => \@tests,
    );

run

Run all the tests

ATTRIBUTES

harness_class

Harness class to use for run tests

harness_formatter

Custom harness formatter

harness_args

More arguments that can be provided to harness object

tests

Test configuration to run

AUTHOR

Pavel R3VoLuT1OneR Zhytomirsky <r3volut1oner@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Pavel R3VoLuT1OneR Zhytomirsky.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.