| 1 | package Test::Pcuke::Gherkin::Node::Outline; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | ▶ | use base 'Test::Pcuke::Gherkin::Node'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | Test::Pcuke::Gherkin::Node::Outline - Scenario Outline class | ||||||||||
| 11 | |||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||
| 13 | |||||||||||
| 14 | TODO SYNOPSIS | ||||||||||
| 15 | |||||||||||
| 16 | use Test::Pcuke::Gherkin::Node::Outline; | ||||||||||
| 17 | |||||||||||
| 18 | my $outline = Test::Pcuke::Gherkin::Node::Outline->new(); | ||||||||||
| 19 | # TODO code example | ||||||||||
| 20 | |||||||||||
| 21 | =head1 METHODS | ||||||||||
| 22 | |||||||||||
| 23 | =head2 new | ||||||||||
| 24 | |||||||||||
| 25 | =cut | ||||||||||
| 26 | |||||||||||
| 27 | 6 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 6 | my ($class, $args) = @_; | |||||||||
| 29 | |||||||||||
| 30 | 6 | $args->{'_nsteps'} = {pass=>0, fail=>0, undef=>0 }; | |||||||||
| 31 | 6 | $args->{'_nscenarios'} = {pass=>0, fail=>0, undef=>0 }; | |||||||||
| 32 | |||||||||||
| 33 | 6 | my $self = $class->SUPER::new( | |||||||||
| 34 | immutables => [qw{title}], | ||||||||||
| 35 | properties => [qw{_nsteps _nscenarios examples steps}], | ||||||||||
| 36 | args => $args, | ||||||||||
| 37 | ); | ||||||||||
| 38 | |||||||||||
| 39 | 6 | return $self; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 2 | ▶ | sub set_title { | ||||||||
|
Subroutine
set_title: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 43 | 2 | my ($self, $title) = @_; | |||||||||
| 44 | 2 | $self->_set_immutable('title', $title); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 2 | ▶ | sub title { $_[0]->_get_immutable('title') } | ||||||||
|
Subroutine
title: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 48 | |||||||||||
| 49 | 6 | ▶ | sub add_examples { | ||||||||
|
Subroutine
add_examples: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 50 | 6 | my ($self, $examples) = @_; | |||||||||
| 51 | 6 | $self->_add_property('examples', $examples); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 5 | ▶ | sub examples { $_[0]->_get_property('examples') } | ||||||||
|
Subroutine
examples: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 55 | |||||||||||
| 56 | 2 | ▶ | sub add_step { | ||||||||
|
Subroutine
add_step: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 57 | 2 | my ($self, $step) = @_; | |||||||||
| 58 | 2 | $self->_add_property('steps', $step); | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 3 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 62 | 3 | my ($self, $background) = @_; | |||||||||
| 63 | 3 | my $scenarioses = $self->examples; | |||||||||
| 64 | 3 | my $steps = $self->_get_property('steps'); | |||||||||
| 65 | |||||||||||
| 66 | 3 | for ( @$scenarioses ){ | |||||||||
| 67 | 6 | $_->execute( $steps, $background ); | |||||||||
| 68 | 6 | $self->collect_stats( $_ ); | |||||||||
| 69 | } | ||||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 6 | ▶ | sub collect_stats { | ||||||||
|
Subroutine
collect_stats: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 73 | 6 | my ($self, $scenarios) = @_; | |||||||||
| 74 | 6 | my $nsteps = $self->nsteps; | |||||||||
| 75 | 6 | my $nscenarios = $self->nscenarios; | |||||||||
| 76 | |||||||||||
| 77 | 6 | my $asteps = $scenarios->nsteps; | |||||||||
| 78 | 6 | my $ascenarios = $scenarios->nscenarios; | |||||||||
| 79 | |||||||||||
| 80 | 6 | for (qw{pass fail undef}) { | |||||||||
| 81 | 18 | $nsteps->{$_} += $asteps->{$_}; | |||||||||
| 82 | 18 | $nscenarios->{$_} += $ascenarios->{$_}; | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 6 | $self->_set_property('_nsteps', $nsteps); | |||||||||
| 86 | 6 | $self->_set_property('_nscenarios', $nscenarios); | |||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | 2 | ▶ | sub steps { $_[0]->_get_property('steps'); } | ||||||||
|
Subroutine
steps: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 90 | |||||||||||
| 91 | 7 | ▶ | sub nsteps { | ||||||||
|
Subroutine
nsteps: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 92 | 7 | my ($self, $status) = @_; | |||||||||
| 93 | 7 | my $nsteps = $self->_get_property('_nsteps'); | |||||||||
| 94 | return $status ? | ||||||||||
| 95 | 7 | ▶ | $nsteps->{$status} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | : $nsteps; | ||||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | 7 | ▶ | sub nscenarios { | ||||||||
|
Subroutine
nscenarios: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 100 | 7 | my ($self, $status) = @_; | |||||||||
| 101 | 7 | my $nscenarios = $self->_get_property('_nscenarios'); | |||||||||
| 102 | |||||||||||
| 103 | return $status ? | ||||||||||
| 104 | 7 | ▶ | $nscenarios->{$status} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 105 | : $nscenarios; | ||||||||||
| 106 | } | ||||||||||
| 107 | |||||||||||
| 108 | |||||||||||
| 109 | |||||||||||
| 110 | 3 | 1; # End of Test::Pcuke::Gherkin::Node::Outline | |||||||||
| 111 | =head1 AUTHOR | ||||||||||
| 112 | |||||||||||
| 113 | Andrei V. Toutoukine, C<< <tut at isuct.ru> >> | ||||||||||
| 114 | |||||||||||
| 115 | =head1 BUGS | ||||||||||
| 116 | |||||||||||
| 117 | Please report any bugs or feature requests to C<bug-/home/tut/bin/src/test-pcuke-gherkin at rt.cpan.org>, or through | ||||||||||
| 118 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=/home/tut/bin/src/Test-Pcuke-Gherkin>. I will be notified, and then you'll | ||||||||||
| 119 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 120 | |||||||||||
| 121 | |||||||||||
| 122 | |||||||||||
| 123 | |||||||||||
| 124 | =head1 SUPPORT | ||||||||||
| 125 | |||||||||||
| 126 | You can find documentation for this module with the perldoc command. | ||||||||||
| 127 | |||||||||||
| 128 | perldoc Test::Pcuke::Gherkin::Node::Outline | ||||||||||
| 129 | |||||||||||
| 130 | |||||||||||
| 131 | You can also look for information at: | ||||||||||
| 132 | |||||||||||
| 133 | =over 4 | ||||||||||
| 134 | |||||||||||
| 135 | =item * RT: CPAN's request tracker | ||||||||||
| 136 | |||||||||||
| 137 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=/home/tut/bin/src/Test-Pcuke-Gherkin> | ||||||||||
| 138 | |||||||||||
| 139 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||
| 140 | |||||||||||
| 141 | L<http://annocpan.org/dist//home/tut/bin/src/Test-Pcuke-Gherkin> | ||||||||||
| 142 | |||||||||||
| 143 | =item * CPAN Ratings | ||||||||||
| 144 | |||||||||||
| 145 | L<http://cpanratings.perl.org/d//home/tut/bin/src/Test-Pcuke-Gherkin> | ||||||||||
| 146 | |||||||||||
| 147 | =item * Search CPAN | ||||||||||
| 148 | |||||||||||
| 149 | L<http://search.cpan.org/dist//home/tut/bin/src/Test-Pcuke-Gherkin/> | ||||||||||
| 150 | |||||||||||
| 151 | =back | ||||||||||
| 152 | |||||||||||
| 153 | |||||||||||
| 154 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 155 | |||||||||||
| 156 | |||||||||||
| 157 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 158 | |||||||||||
| 159 | Copyright 2011 Andrei V. Toutoukine. | ||||||||||
| 160 | |||||||||||
| 161 | This program is released under the following license: artistic | ||||||||||
| 162 | |||||||||||
| 163 | |||||||||||
| 164 | =cut | ||||||||||
| 165 | |||||||||||