line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Pcuke::Gherkin::Node::Table::Row; |
2
|
4
|
|
|
4
|
|
147864
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
136
|
|
3
|
4
|
|
|
4
|
|
25
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
132
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
30
|
use base 'Test::Pcuke::Gherkin::Node'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
941
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
22
|
use Carp; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
3808
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Test::Pcuke::Gherkin::Node::Table::Row - row of the table wrapper object |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
TODO SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Test::Pcuke::Gherkin::Node::Table::Row; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $row = Test::Pcuke::Gherkin::Node::Table::Row->new(); |
20
|
|
|
|
|
|
|
# TODO code example |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 new |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
3
|
|
|
3
|
1
|
905
|
my ($class, $args) = @_; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
18
|
$args->{'_nsteps'} = {pass=>0, fail=>0, undef=>0}; |
32
|
3
|
|
|
|
|
12
|
$args->{'_nscenarios'} = {pass=>0, fail=>0, undef=>0}; |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
28
|
my $instance = $class->SUPER::new( |
35
|
|
|
|
|
|
|
immutables => [qw{data executor}], |
36
|
|
|
|
|
|
|
properties => [qw{_nsteps _nscenarios}], |
37
|
|
|
|
|
|
|
args => $args |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
|
|
14
|
return $instance; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub set_data { |
44
|
2
|
|
|
2
|
0
|
17
|
my ($self, $hash) = @_; |
45
|
2
|
|
|
|
|
14
|
$self->_set_immutable('data', $hash); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
3
|
0
|
21
|
sub data { $_[0]->_get_immutable('data') } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub nsteps { |
51
|
5
|
|
|
5
|
0
|
11
|
my ($self, $status) = @_; |
52
|
5
|
|
|
|
|
20
|
my $nsteps = $self->_get_property('_nsteps'); |
53
|
|
|
|
|
|
|
|
54
|
5
|
100
|
|
|
|
33
|
return $status ? |
55
|
|
|
|
|
|
|
$nsteps->{$status} |
56
|
|
|
|
|
|
|
: $nsteps; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub nscenarios { |
60
|
1
|
|
|
1
|
0
|
4
|
my ($self, $status) = @_; |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
2
|
my $nscenarios; |
63
|
|
|
|
|
|
|
|
64
|
1
|
50
|
|
|
|
5
|
if ( $self->nsteps('fail') > 0 ) { |
|
|
0
|
|
|
|
|
|
65
|
1
|
|
|
|
|
5
|
$nscenarios = {fail => 1, pass => 0, undef => 0}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
elsif ( $self->nsteps('undef') > 0 ) { |
68
|
0
|
|
|
|
|
0
|
$nscenarios = {fail => 0, pass => 0, undef => 1}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
0
|
|
|
|
|
0
|
$nscenarios = {fail => 0, pass => 1, undef => 0}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
1
|
50
|
|
|
|
9
|
return $status ? |
75
|
|
|
|
|
|
|
$nscenarios->{$status} |
76
|
|
|
|
|
|
|
: $nscenarios; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
0
|
0
|
sub set_executor { $_[0]->_set_immutable('executor', $_[1] ) } |
80
|
1
|
|
|
1
|
0
|
7
|
sub executor { $_[0]->_get_immutable('executor') } |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub execute { |
83
|
1
|
|
|
1
|
0
|
904
|
my ($self, $steps, $background) = @_; |
84
|
1
|
|
|
|
|
2
|
my $status; |
85
|
|
|
|
|
|
|
|
86
|
1
|
50
|
33
|
|
|
6
|
if ( $self->executor && $self->executor->can('reset_world') ) { |
87
|
0
|
|
|
|
|
0
|
$self->executor->reset_world; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
1
|
50
|
|
|
|
5
|
if ($background) { |
91
|
1
|
|
|
|
|
24
|
$background->execute; |
92
|
1
|
|
|
|
|
149
|
$self->collect_stats($background); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
1
|
|
|
|
|
4
|
foreach my $s ( @$steps ) { |
96
|
2
|
|
|
|
|
104
|
$s->set_params( $self->data ); |
97
|
|
|
|
|
|
|
|
98
|
2
|
|
|
|
|
161
|
$s->execute(); |
99
|
2
|
|
|
|
|
105
|
$self->collect_stats( $s ); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# TODO move this to collect_stats |
102
|
2
|
|
|
|
|
4
|
for ( @{ $s->param_names } ) { |
|
2
|
|
|
|
|
18
|
|
103
|
2
|
|
|
|
|
154
|
push @{ $status->{$_}->{status} }, $s->status; |
|
2
|
|
|
|
|
12
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
2
|
|
|
|
|
107
|
$s->unset_params; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
1
|
|
|
|
|
54
|
$self->_set_status($status); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub collect_stats { |
114
|
3
|
|
|
3
|
0
|
8
|
my ($self, $step) = @_; |
115
|
|
|
|
|
|
|
|
116
|
3
|
|
|
|
|
6
|
my $nsteps = $self->nsteps; |
117
|
|
|
|
|
|
|
|
118
|
3
|
100
|
|
|
|
12
|
if ( $step->can('nsteps') ) { |
119
|
|
|
|
|
|
|
#background |
120
|
1
|
|
|
|
|
45
|
my $bg_nsteps = $step->nsteps; |
121
|
1
|
|
|
|
|
55
|
for (qw{pass fail undef}) { |
122
|
3
|
|
|
|
|
8
|
$nsteps->{$_} += $bg_nsteps->{$_}; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
else { |
126
|
|
|
|
|
|
|
#step |
127
|
2
|
|
|
|
|
57
|
$nsteps->{ $step->status }++; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
3
|
|
|
|
|
154
|
$self->_set_property('_nsteps', $nsteps); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub _set_status { |
134
|
1
|
|
|
1
|
|
2
|
my ($self, $status) = @_; |
135
|
1
|
|
|
|
|
2
|
my $final_status; |
136
|
|
|
|
|
|
|
my $exceptions; |
137
|
|
|
|
|
|
|
|
138
|
1
|
|
|
|
|
12
|
for my $p ( keys %$status ) { |
139
|
2
|
|
|
|
|
3
|
for my $s ( @{ $status->{$p}->{status} } ) { |
|
2
|
|
|
|
|
6
|
|
140
|
2
|
50
|
|
|
|
6
|
if ( ! $final_status->{$p} ) { |
141
|
2
|
|
|
|
|
8
|
$final_status->{$p} = $s; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
else { |
144
|
0
|
0
|
0
|
|
|
0
|
$final_status->{$p} = $s if $s eq 'undef' && $final_status->{$p} eq 'pass'; |
145
|
0
|
0
|
|
|
|
0
|
$final_status->{$p} = $s if $s eq 'fail'; |
146
|
0
|
0
|
|
|
|
0
|
last if $s eq 'fail'; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
1
|
|
|
|
|
4
|
$self->_set_property('status', $final_status); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
3
|
|
|
3
|
0
|
15
|
sub status { $_[0]->_get_property('status') } |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub column_status { |
157
|
2
|
|
|
2
|
0
|
4834
|
my ($self, $param_name) = @_; |
158
|
2
|
|
|
|
|
8
|
my $status = $self->status; |
159
|
|
|
|
|
|
|
|
160
|
2
|
|
|
|
|
12
|
return $status->{$param_name}; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
1; # End of Test::Pcuke::Gherkin::Node::Table::Row |
165
|
|
|
|
|
|
|
__END__ |