line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
12
|
|
|
12
|
|
6945
|
use v5.14; |
|
12
|
|
|
|
|
54
|
|
2
|
12
|
|
|
12
|
|
72
|
use warnings; |
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
600
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::BDD::Cucumber::Harness 0.85; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Test::BDD::Cucumber::Harness - Base class for creating harnesses |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 0.85 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Harnesses allow your feature files to be executed while telling the outside |
17
|
|
|
|
|
|
|
world about how the testing is going, and what's being tested. This is a base |
18
|
|
|
|
|
|
|
class for creating new harnesses. You can see |
19
|
|
|
|
|
|
|
L and |
20
|
|
|
|
|
|
|
L for examples, although if you need |
21
|
|
|
|
|
|
|
to interact with the results in a more exciting way, you'd be best off |
22
|
|
|
|
|
|
|
interacting with L. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS / EVENTS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
12
|
|
|
12
|
|
73
|
use Moo; |
|
12
|
|
|
|
|
36
|
|
|
12
|
|
|
|
|
76
|
|
29
|
12
|
|
|
12
|
|
4358
|
use Types::Standard qw( ArrayRef ); |
|
12
|
|
|
|
|
75
|
|
|
12
|
|
|
|
|
92
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'results' => ( is => 'ro', default => sub { [] }, isa => ArrayRef ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 feature |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 feature_done |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Called at the start and end of feature execution respectively. Both methods |
38
|
|
|
|
|
|
|
accept a single argument of a L. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
0
|
sub feature { my ( $self, $feature ) = @_; } |
43
|
9
|
|
|
9
|
1
|
64
|
sub feature_done { my ( $self, $feature ) = @_; } |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 background |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 background_done |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
If you have a background section, then we execute it as a quasi-scenario step |
50
|
|
|
|
|
|
|
before each scenario. These hooks are fired before and after that, and passed |
51
|
|
|
|
|
|
|
in the L that represents the Background |
52
|
|
|
|
|
|
|
section, and a a dataset hash (although why would you use that?) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
31
|
|
|
31
|
1
|
162
|
sub background { my ( $self, $scenario, $dataset ) = @_; } |
57
|
31
|
|
|
31
|
1
|
124
|
sub background_done { my ( $self, $scenario, $dataset ) = @_; } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 scenario |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 scenario_done |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Called at the start and end of scenario execution respectively. Both methods |
64
|
|
|
|
|
|
|
accept a L module and a dataset hash. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
0
|
1
|
0
|
sub scenario { my ( $self, $scenario, $dataset ) = @_; } |
69
|
0
|
|
|
0
|
1
|
0
|
sub scenario_done { my ( $self, $scenario, $dataset ) = @_; } |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 step |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 step_done |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Called at the start and end of step execution respectively. Both methods |
76
|
|
|
|
|
|
|
accept a L object. C also accepts |
77
|
|
|
|
|
|
|
a L object and an arrayref of arrayrefs with |
78
|
|
|
|
|
|
|
locations of consolidated matches, for highlighting. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
[ [2,5], [7,9] ] |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
0
|
1
|
0
|
sub step { my ( $self, $context ) = @_; } |
85
|
0
|
|
|
0
|
1
|
0
|
sub step_done { my ( $self, $context, $result ) = @_; } |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 sub_step |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 sub_step_done |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
As per C and C, but for steps that have been called from other |
92
|
|
|
|
|
|
|
steps. None of the included harnesses respond to these methods, because |
93
|
|
|
|
|
|
|
generally the whole thing should be transparent, and the parent step handles |
94
|
|
|
|
|
|
|
passes, failures, etc. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
12
|
|
|
12
|
1
|
32
|
sub sub_step { my ( $self, $context ) = @_; } |
99
|
12
|
|
|
12
|
1
|
37
|
sub sub_step_done { my ( $self, $context, $result ) = @_; } |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 startup |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 shutdown |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Some tests will run one feature, some will run many. For this reason, you may |
106
|
|
|
|
|
|
|
have harnesses that have something they need to do on start (print an HTML |
107
|
|
|
|
|
|
|
header), that they shouldn't do at the start of every feature, or a close-down |
108
|
|
|
|
|
|
|
task (like running C), that again shouldn't happen on I |
109
|
|
|
|
|
|
|
feature close-out, just the last. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Just C<$self> as the single argument for both. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
1
|
|
|
1
|
1
|
2
|
sub startup { my $self = shift; } |
116
|
0
|
|
|
0
|
1
|
0
|
sub shutdown { my $self = shift; } |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 add_result |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Called before C with the step's result. Expected to silently add the |
121
|
|
|
|
|
|
|
result in to a pool that facilitate the C method. No need to override |
122
|
|
|
|
|
|
|
this behaviour. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 result |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Returns a collective view on the passing status of all steps run so far, |
127
|
|
|
|
|
|
|
as a L object. Default implementation should |
128
|
|
|
|
|
|
|
be fine for all your needs. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub add_result { |
133
|
627
|
|
|
627
|
1
|
1037
|
my $self = shift; |
134
|
627
|
|
|
|
|
876
|
push( @{ $self->results }, shift() ); |
|
627
|
|
|
|
|
1991
|
|
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub result { |
138
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
139
|
|
|
|
|
|
|
return Test::BDD::Cucumber::Model::Result->from_children( |
140
|
1
|
|
|
|
|
2
|
@{ $self->results } ); |
|
1
|
|
|
|
|
8
|
|
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 AUTHOR |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Peter Sergeant C |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 LICENSE |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Copyright 2019-2023, Erik Huelsmann |
150
|
|
|
|
|
|
|
Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
1; |