| 1 | # ABSTRACT: TestRail testing harness | ||||||||||
| 2 | # PODNAME: Test::Rail::Harness | ||||||||||
| 3 | package Test::Rail::Harness; | ||||||||||
| 4 | 2 | $Test::Rail::Harness::VERSION = '0.052'; | |||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use parent qw/TAP::Harness/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | # inject parser_class as Test::Rail::Parser. | ||||||||||
| 11 | 8 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 12 | 8 | my $class = shift; | |||||||||
| 13 | 8 | my $arg_for = shift; | |||||||||
| 14 | 8 | $arg_for->{parser_class} = 'Test::Rail::Parser'; | |||||||||
| 15 | 8 | my $self = $class->SUPER::new($arg_for); | |||||||||
| 16 | 8 | return $self; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 9 | ▶ | sub make_parser { | ||||||||
|
Subroutine
make_parser: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||
| 20 | 9 | my ( $self, $job ) = @_; | |||||||||
| 21 | 9 | my $args = $self->SUPER::_get_parser_args($job); | |||||||||
| 22 | 9 | my @configs = (); | |||||||||
| 23 | 9 | my @sections = (); | |||||||||
| 24 | |||||||||||
| 25 | #XXX again, don't see any way of getting this downrange to my parser :( | ||||||||||
| 26 | 9 | $args->{'apiurl'} = $ENV{'TESTRAIL_APIURL'}; | |||||||||
| 27 | 9 | $args->{'user'} = $ENV{'TESTRAIL_USER'}; | |||||||||
| 28 | 9 | $args->{'pass'} = $ENV{'TESTRAIL_PASS'}; | |||||||||
| 29 | 9 | $args->{'encoding'} = $ENV{'TESTRAIL_ENCODING'}; | |||||||||
| 30 | 9 | $args->{'project'} = $ENV{'TESTRAIL_PROJ'}; | |||||||||
| 31 | 9 | $args->{'run'} = $ENV{'TESTRAIL_RUN'}; | |||||||||
| 32 | 9 | $args->{'plan'} = $ENV{'TESTRAIL_PLAN'}; | |||||||||
| 33 | 9 | $args->{'plan_id'} = $ENV{'TESTRAIL_PLAN_ID'}; | |||||||||
| 34 | @configs = split( /:/, $ENV{'TESTRAIL_CONFIGS'} ) | ||||||||||
| 35 | 9 | ▶ | if $ENV{'TESTRAIL_CONFIGS'}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 9 | ▶ | $args->{'configs'} = \@configs if scalar(@configs); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | $args->{'result_options'} = { 'version' => $ENV{'TESTRAIL_VERSION'} } | ||||||||||
| 38 | 9 | ▶ | if $ENV{'TESTRAIL_VERSION'}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 9 | $args->{'step_results'} = $ENV{'TESTRAIL_STEPS'}; | |||||||||
| 40 | 9 | $args->{'testsuite_id'} = $ENV{'TESTRAIL_SPAWN'}; | |||||||||
| 41 | 9 | $args->{'testsuite'} = $ENV{'TESTRAIL_TESTSUITE'}; | |||||||||
| 42 | 9 | $args->{'config_group'} = $ENV{'TESTRAIL_CGROUP'}; | |||||||||
| 43 | 9 | $args->{'test_bad_status'} = $ENV{'TESTRAIL_TBAD'}; | |||||||||
| 44 | 9 | $args->{'max_tries'} = $ENV{'TESTRAIL_MAX_TRIES'}; | |||||||||
| 45 | |||||||||||
| 46 | @sections = split( /:/, $ENV{'TESTRAIL_SECTIONS'} ) | ||||||||||
| 47 | 9 | ▶ | if $ENV{'TESTRAIL_SECTIONS'}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 9 | ▶ | $args->{'sections'} = \@sections if scalar(@sections); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 9 | $args->{'autoclose'} = $ENV{'TESTRAIL_AUTOCLOSE'}; | |||||||||
| 50 | |||||||||||
| 51 | #for Testability of plugin XXX probably some of the last remaining grotiness | ||||||||||
| 52 | 9 | ▶ | if ( $ENV{'TESTRAIL_MOCKED'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 2 | ▶ | use lib 't/lib' | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 54 | 2 | ; #Unit tests will always run from the main dir during make test | |||||||||
| 55 | 9 | ▶ | if ( !defined $Test::LWP::UserAgent::TestRailMock::mockObject ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 1 | require 't/lib/Test/LWP/UserAgent/TestRailMock.pm'; ## no critic | |||||||||
| 57 | } | ||||||||||
| 58 | 9 | $args->{'debug'} = 1; | |||||||||
| 59 | 9 | $args->{'browser'} = $Test::LWP::UserAgent::TestRailMock::mockObject; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 9 | $self->SUPER::_make_callback( 'parser_args', $args, $job->as_array_ref ); | |||||||||
| 63 | 9 | my $parser = $self->SUPER::_construct( $self->SUPER::parser_class, $args ); | |||||||||
| 64 | |||||||||||
| 65 | 9 | $self->SUPER::_make_callback( 'made_parser', $parser, $job->as_array_ref ); | |||||||||
| 66 | 9 | my $session = | |||||||||
| 67 | $self->SUPER::formatter->open_test( $job->description, $parser ); | ||||||||||
| 68 | |||||||||||
| 69 | 9 | return ( $parser, $session ); | |||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 2 | 1; | |||||||||
| 73 | |||||||||||
| 74 | __END__ | ||||||||||