line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Pcuke::Gherkin::Node::Feature; |
2
|
3
|
|
|
3
|
|
161479
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
121
|
|
3
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
94
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
88
|
use base qw{Test::Pcuke::Gherkin::Node}; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
2128
|
|
6
|
3
|
|
|
3
|
|
19
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
2141
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Test::Pcuke::Gherkin::Node::Feature - Represents a feature |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
TODO SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Test::Pcuke::Gherkin::Node::Feature; |
17
|
|
|
|
|
|
|
#TODO |
18
|
|
|
|
|
|
|
... |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 new |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
12
|
|
|
12
|
1
|
4316
|
my($class, $args) = @_; |
28
|
|
|
|
|
|
|
|
29
|
12
|
|
|
|
|
34
|
my $properties = [ qw{scenarios _nsteps _nscenarios} ]; |
30
|
12
|
|
|
|
|
27
|
my $immutables = [ qw{title narrative background} ]; |
31
|
|
|
|
|
|
|
|
32
|
12
|
|
|
|
|
59
|
$args->{_nsteps} = { pass=>0, undef=>0, fail=>0}; |
33
|
12
|
|
|
|
|
43
|
$args->{_nscenarios}= { pass=>0, undef=>0, fail=>0}; |
34
|
|
|
|
|
|
|
|
35
|
12
|
|
|
|
|
70
|
my $self = $class->SUPER::new( |
36
|
|
|
|
|
|
|
properties => $properties, |
37
|
|
|
|
|
|
|
immutables => $immutables, |
38
|
|
|
|
|
|
|
args => $args |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
12
|
|
|
|
|
47
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub set_title { |
45
|
4
|
|
|
4
|
0
|
74
|
my ($self, $title) = @_; |
46
|
4
|
|
|
|
|
51
|
$self->_set_immutable('title', $title); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub set_narrative { |
50
|
4
|
|
|
4
|
0
|
147
|
my ($self, $narrative) = @_; |
51
|
|
|
|
|
|
|
|
52
|
4
|
|
|
|
|
23
|
$self->_set_immutable('narrative', $narrative); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
4
|
100
|
|
4
|
0
|
32
|
sub title { $_[0]->_get_immutable('title') || q{} } |
57
|
4
|
100
|
|
4
|
0
|
27
|
sub narrative{ $_[0]->_get_immutable('narrative') || q{} } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub add_scenario { |
60
|
11
|
|
|
11
|
0
|
2802
|
my ($self, $scenario) = @_; |
61
|
|
|
|
|
|
|
|
62
|
11
|
|
|
|
|
47
|
$self->_add_property('scenarios', $scenario); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub add_outline { |
66
|
2
|
|
|
2
|
0
|
460
|
my ($self, $outline) = @_; |
67
|
2
|
|
|
|
|
6
|
$self->add_scenario( $outline ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub set_background { |
71
|
1
|
|
|
1
|
0
|
8
|
my ($self, $bgr) = @_; |
72
|
1
|
|
|
|
|
6
|
$self->_set_immutable('background', $bgr); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
16
|
|
|
16
|
0
|
7129
|
sub background { $_[0]->_get_immutable('background') } |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub scenarios { |
78
|
1
|
|
|
1
|
0
|
37
|
my ($self) = @_; |
79
|
1
|
|
|
|
|
7
|
return $self->_get_property('scenarios'); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub execute { |
83
|
5
|
|
|
5
|
0
|
22
|
my ($self) = @_; |
84
|
5
|
|
|
|
|
17
|
my $scenarios = $self->_get_property('scenarios'); |
85
|
|
|
|
|
|
|
|
86
|
5
|
|
|
|
|
15
|
foreach ( @$scenarios ) { |
87
|
14
|
|
|
|
|
30
|
$_->execute( $self->background ); |
88
|
14
|
|
|
|
|
876
|
$self->collect_stats( $_ ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
5
|
|
|
|
|
17
|
return $self; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub collect_stats { |
95
|
14
|
|
|
14
|
0
|
24
|
my ($self, $scenario) = @_; |
96
|
|
|
|
|
|
|
|
97
|
14
|
|
|
|
|
30
|
my $nsteps = $self->nsteps; |
98
|
14
|
|
|
|
|
31
|
my $nscenarios = $self->nscenarios; |
99
|
|
|
|
|
|
|
|
100
|
14
|
|
|
|
|
46
|
my $asteps = $scenario->nsteps; |
101
|
14
|
|
|
|
|
1071
|
my $ascenarios = $scenario->nscenarios; |
102
|
|
|
|
|
|
|
|
103
|
14
|
|
|
|
|
843
|
for (qw{pass fail undef}) { |
104
|
42
|
|
|
|
|
200
|
$nsteps->{$_} += $asteps->{$_}; |
105
|
42
|
|
|
|
|
87
|
$nscenarios->{$_} += $ascenarios->{$_}; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
14
|
|
|
|
|
45
|
$self->_set_property('_nsteps', $nsteps); |
109
|
14
|
|
|
|
|
36
|
$self->_set_property('_nscenarios', $nscenarios); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub nsteps { |
113
|
16
|
|
|
16
|
0
|
1267
|
my ($self, $status) = @_; |
114
|
|
|
|
|
|
|
|
115
|
16
|
|
|
|
|
41
|
my $nsteps = $self->_get_property('_nsteps'); |
116
|
|
|
|
|
|
|
|
117
|
16
|
50
|
|
|
|
54
|
return $status ? |
118
|
|
|
|
|
|
|
$nsteps->{$status} |
119
|
|
|
|
|
|
|
: $nsteps; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub nscenarios { |
123
|
15
|
|
|
15
|
0
|
30
|
my ($self, $status) = @_; |
124
|
15
|
|
|
|
|
34
|
my $nscenarios = $self->_get_property('_nscenarios'); |
125
|
|
|
|
|
|
|
|
126
|
15
|
50
|
|
|
|
39
|
return $status ? |
127
|
|
|
|
|
|
|
$nscenarios->{$status} |
128
|
|
|
|
|
|
|
: $nscenarios; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; # End of Test::Pcuke::Gherkin::Node::Feature |
132
|
|
|
|
|
|
|
__END__ |