line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
106730
|
use v5.14; |
|
6
|
|
|
|
|
35
|
|
2
|
6
|
|
|
6
|
|
45
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
347
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::BDD::Cucumber::Loader 0.85; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Test::BDD::Cucumber::Loader - Simplify loading of Step Definition and feature files |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 0.85 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Makes loading Step Definition files and Feature files a breeze... |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 METHODS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 load |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Accepts a path, and returns a L object with the Step |
23
|
|
|
|
|
|
|
Definition files loaded, and a list of L objects. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 load_steps |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Accepts an L object and a string representing either a |
28
|
|
|
|
|
|
|
step file, or a directory containing zero or more C<*_steps.pl> files, and loads |
29
|
|
|
|
|
|
|
the steps in to the executor; if you've used C we'll have already scanned |
30
|
|
|
|
|
|
|
the feature directory for C<*_steps.pl> files. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
6
|
|
|
6
|
|
477
|
use Path::Class; |
|
6
|
|
|
|
|
42747
|
|
|
6
|
|
|
|
|
698
|
|
36
|
6
|
|
|
6
|
|
3280
|
use File::Find::Rule; |
|
6
|
|
|
|
|
46561
|
|
|
6
|
|
|
|
|
46
|
|
37
|
|
|
|
|
|
|
|
38
|
6
|
|
|
6
|
|
2728
|
use Test::BDD::Cucumber::Executor; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
247
|
|
39
|
6
|
|
|
6
|
|
2930
|
use Test::BDD::Cucumber::Parser; |
|
6
|
|
|
|
|
131
|
|
|
6
|
|
|
|
|
247
|
|
40
|
6
|
|
|
6
|
|
147
|
use Test::BDD::Cucumber::StepFile(); |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
1811
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub load { |
43
|
8
|
|
|
8
|
1
|
1229
|
my ( $class, $path ) = @_; |
44
|
|
|
|
|
|
|
|
45
|
8
|
|
|
|
|
165
|
my $executor = Test::BDD::Cucumber::Executor->new(); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Either load a feature or a directory... |
48
|
8
|
|
|
|
|
269
|
my ( $dir, $file ); |
49
|
8
|
50
|
|
|
|
248
|
if ( -f $path ) { |
50
|
0
|
|
|
|
|
0
|
$file = file($path); |
51
|
0
|
|
|
|
|
0
|
$dir = $file->dir; |
52
|
|
|
|
|
|
|
} else { |
53
|
8
|
|
|
|
|
171
|
$dir = dir($path); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Load up the steps |
57
|
8
|
|
|
|
|
830
|
$class->load_steps( $executor, $dir ); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Grab the feature files |
60
|
|
|
|
|
|
|
my @features = map { |
61
|
8
|
50
|
|
|
|
345
|
my $file = file($_); |
|
13
|
|
|
|
|
14446
|
|
62
|
13
|
|
|
|
|
1685
|
my $feature = |
63
|
|
|
|
|
|
|
Test::BDD::Cucumber::Parser->parse_file( $file ); |
64
|
|
|
|
|
|
|
} ( |
65
|
|
|
|
|
|
|
$file |
66
|
|
|
|
|
|
|
? ( $file . '' ) |
67
|
|
|
|
|
|
|
: File::Find::Rule->file()->name('*.feature')->in($dir) |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
8
|
|
|
|
|
107
|
return ( $executor, @features ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub load_steps { |
74
|
8
|
|
|
8
|
1
|
34
|
my ( $class, $executor, $path ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
8
|
50
|
|
|
|
215
|
if ( -f $path ) { |
77
|
0
|
|
|
|
|
0
|
$executor->add_steps( Test::BDD::Cucumber::StepFile->load($path) ); |
78
|
|
|
|
|
|
|
} else { |
79
|
|
|
|
|
|
|
$executor->add_steps( Test::BDD::Cucumber::StepFile->load($_) ) |
80
|
8
|
|
|
|
|
671
|
for File::Find::Rule->file()->name('*_steps.pl')->in($path); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
8
|
|
|
|
|
103
|
return $class; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Peter Sergeant C |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 LICENSE |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Copyright 2019-2023, Erik Huelsmann |
93
|
|
|
|
|
|
|
Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |