line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Pcuke::Gherkin::Node::Scenario; |
2
|
3
|
|
|
3
|
|
181617
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
237
|
|
3
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
116
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
18
|
use base 'Test::Pcuke::Gherkin::Node'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
2331
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Test::Cucumber::Scenario - Represents a scenario |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Perhaps a little code snippet. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Test::Pcuke::Gherkin::Node::Scenario; |
16
|
|
|
|
|
|
|
# TODO |
17
|
|
|
|
|
|
|
... |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 new |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
6
|
|
|
6
|
1
|
6235
|
my($class, $args) = @_; |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
|
|
22
|
my $properties = [ qw{steps _nsteps} ]; |
29
|
6
|
|
|
|
|
19
|
my $immutables = [ qw{title executor} ]; |
30
|
|
|
|
|
|
|
|
31
|
6
|
|
|
|
|
37
|
$args->{_nsteps} = { |
32
|
|
|
|
|
|
|
pass=>0, |
33
|
|
|
|
|
|
|
fail=>0, |
34
|
|
|
|
|
|
|
undef=>0 |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
|
|
50
|
my $self = $class->SUPER::new( |
38
|
|
|
|
|
|
|
properties => $properties, |
39
|
|
|
|
|
|
|
immutables => $immutables, |
40
|
|
|
|
|
|
|
args => $args |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
6
|
|
|
|
|
25
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub set_title { |
47
|
5
|
|
|
5
|
0
|
125
|
my ($self, $title) = @_; |
48
|
5
|
|
|
|
|
35
|
$self->_set_immutable('title', $title); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
3
|
100
|
|
3
|
0
|
30
|
sub title { $_[0]->_get_immutable('title') || q{}; } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub add_step { |
55
|
6
|
|
|
6
|
0
|
12139
|
my ($self, $step) = @_; |
56
|
6
|
|
|
|
|
40
|
$self->_add_property('steps', $step); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub steps { |
60
|
1
|
|
|
1
|
0
|
2757
|
my ($self) = @_; |
61
|
1
|
|
|
|
|
6
|
return $self->_get_property('steps'); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub nsteps { |
66
|
14
|
|
|
14
|
0
|
1347
|
my ($self, $status) = @_; |
67
|
14
|
|
|
|
|
1669
|
my $nsteps = $self->_get_property('_nsteps'); |
68
|
|
|
|
|
|
|
|
69
|
14
|
50
|
|
|
|
69
|
return $status ? |
70
|
|
|
|
|
|
|
$nsteps->{$status} |
71
|
|
|
|
|
|
|
: $nsteps; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub nscenarios { |
75
|
1
|
|
|
1
|
0
|
3
|
my ($self, $status) = @_; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
8
|
my $nsteps = $self->nsteps; |
78
|
1
|
|
|
|
|
3
|
my $nscenarios; |
79
|
|
|
|
|
|
|
|
80
|
1
|
50
|
|
|
|
4
|
if ( $nsteps->{fail} > 0 ) { |
|
|
0
|
|
|
|
|
|
81
|
1
|
|
|
|
|
19
|
$nscenarios = { pass=>0, fail=>1, undef=>0 }; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
elsif ( $nsteps->{undef} > 0 ) { |
84
|
0
|
|
|
|
|
0
|
$nscenarios = { pass=>0, fail=>0, undef=>1 }; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
else { |
87
|
0
|
|
|
|
|
0
|
$nscenarios = { pass=>1, fail=>0, undef=>0 }; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
1
|
50
|
|
|
|
10
|
return $status ? |
91
|
|
|
|
|
|
|
$nscenarios->{$status} |
92
|
|
|
|
|
|
|
: $nscenarios; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub execute { |
97
|
3
|
|
|
3
|
0
|
21
|
my ($self, $background) = @_; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
23
|
my $executor = $self->_get_immutable('executor'); |
100
|
3
|
50
|
33
|
|
|
17
|
if ( $executor && $executor->can('reset_world') ) { |
101
|
0
|
|
|
|
|
0
|
$executor->reset_world; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
3
|
|
|
|
|
14
|
my $steps = $self->_get_property('steps'); |
105
|
|
|
|
|
|
|
|
106
|
3
|
100
|
|
|
|
15
|
if ( $background ){ |
107
|
1
|
|
|
|
|
6
|
$background->execute; |
108
|
1
|
|
|
|
|
94
|
$self->collect_stats($background); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
3
|
|
|
|
|
10
|
foreach my $step (@$steps) { |
112
|
10
|
|
|
|
|
546
|
$step->execute(); |
113
|
10
|
|
|
|
|
772
|
$self->collect_stats($step); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub collect_stats { |
118
|
11
|
|
|
11
|
0
|
18
|
my ($self, $step) = @_; |
119
|
|
|
|
|
|
|
|
120
|
11
|
|
|
|
|
37
|
my $nsteps = $self->nsteps; |
121
|
|
|
|
|
|
|
|
122
|
11
|
100
|
|
|
|
42
|
if ( $step->can('nsteps') ) { |
123
|
1
|
|
|
|
|
75
|
my $bg_nsteps = $step->nsteps; |
124
|
1
|
|
|
|
|
66
|
for (qw{pass fail undef}) { |
125
|
3
|
|
|
|
|
11
|
$nsteps->{$_} += $bg_nsteps->{$_}; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
else { |
129
|
|
|
|
|
|
|
# a step |
130
|
10
|
|
|
|
|
322
|
$nsteps->{ $step->status }++; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; # End of Test::Pcuke::Gherkin::Node::Scenario |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 AUTHOR |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Andrei V. Toutoukine, C<< >> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 BUGS |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
144
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
145
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 SUPPORT |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
perldoc Test::Pcuke::Gherkin::Node::Scenario |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
You can also look for information at: |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=over 4 |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * CPAN Ratings |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
L |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item * Search CPAN |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
L |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Copyright 2011 Andrei V. Toutoukine. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This program is released under the following license: artistic |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
191
|
|
|
|
|
|
|
|